Skip to content

Commit

Permalink
add(command): make:table
Browse files Browse the repository at this point in the history
  • Loading branch information
uyab committed Feb 19, 2020
1 parent 3dc6478 commit 66269dc
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 3 deletions.
24 changes: 24 additions & 0 deletions resources/stubs/table.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

namespace App\Tables;

use Laravolt\Suitable\TableView;

class DummyClass extends TableView
{
protected $title = 'DummyClass';

protected function source()
{
// return Model::paginate();
}

protected function columns()
{
return [
// See https://laravolt.dev/docs/suitable/
];
}
}
26 changes: 26 additions & 0 deletions src/Platform/Commands/MakeTableCommnad.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

declare(strict_types=1);

namespace Laravolt\Platform\Commands;

use Illuminate\Console\GeneratorCommand;

class MakeTableCommnad extends GeneratorCommand
{
protected $type = 'Class';

protected $name = "make:table {name}";

protected $description = 'Create a new Table builder';

protected function getStub()
{
return platform_path('resources/stubs/table.stub');
}

protected function getDefaultNamespace($rootNamespace)
{
return $rootNamespace.'\Tables';
}
}
8 changes: 5 additions & 3 deletions src/Platform/Providers/PlatformServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Laravolt\Epicentrum\Console\Commands\ManageUser;
use Laravolt\Platform\Commands\AdminCommand;
use Laravolt\Platform\Commands\LinkCommand;
use Laravolt\Platform\Commands\MakeTableCommnad;
use Laravolt\Platform\Commands\SyncPermission;
use Laravolt\Platform\Enums\Permission;
use Laravolt\Platform\Services\Acl;
Expand All @@ -25,11 +26,12 @@
class PlatformServiceProvider extends \Illuminate\Support\ServiceProvider
{
protected $commands = [
SyncPermission::class,
AdminCommand::class,
LinkCommand::class,
ManageUser::class,
MakeTableCommnad::class,
ManageRole::class,
ManageUser::class,
LinkCommand::class,
SyncPermission::class,
];

public function register(): void
Expand Down

0 comments on commit 66269dc

Please sign in to comment.