Skip to content

Commit

Permalink
Improve dev tool
Browse files Browse the repository at this point in the history
  • Loading branch information
sangnguyenplus committed May 5, 2024
1 parent 60fec2b commit 13ce398
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
13 changes: 6 additions & 7 deletions src/Commands/PluginMakeCrudCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,19 @@ protected function removeUnusedFiles(string $location): void
$files = [
Helper::joinPaths(['config', 'permissions.stub']),
Helper::joinPaths(['routes', 'web.stub']),
Helper::joinPaths(['helpers', 'helpers.stub']),
Helper::joinPaths(['resources', 'views', '.gitkeep']),
'composer.json',
Helper::joinPaths(['src', 'Providers', '{Module}ServiceProvider.stub']),
Helper::joinPaths(['src', 'Forms', 'Settings', '{Module}Form.stub']),
Helper::joinPaths(['src', 'Http', 'Controllers', 'Settings', '{Module}Controller.stub']),
Helper::joinPaths(['src', 'Http', 'Requests', 'Settings', '{Module}Request.stub']),
Helper::joinPaths(['src', 'PanelSections', '{Module}PanelSection.stub']),
Helper::joinPaths(['src', 'Providers', '{Name}ServiceProvider.stub']),
Helper::joinPaths(['src', 'Forms', 'Settings', '{Name}Form.stub']),
Helper::joinPaths(['src', 'Http', 'Controllers', 'Settings', '{Name}Controller.stub']),
Helper::joinPaths(['src', 'Http', 'Requests', 'Settings', '{Name}Request.stub']),
Helper::joinPaths(['src', 'PanelSections', '{Name}PanelSection.stub']),
];

foreach ($files as $file) {
File::delete(Helper::joinPaths([$location, $file]));
}

File::deleteDirectory(Helper::joinPaths([$location, 'src', 'PanelSections', '']));
}

public function getReplacements(string $replaceText): array
Expand Down
8 changes: 4 additions & 4 deletions stubs/module/src/Http/Controllers/{Name}Controller.stub
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ class {Name}Controller extends BaseController
{
$this
->breadcrumb()
->add(trans(trans('{types}/{-name}::{-name}.name')), route('{-name}.index'));
->add(trans(trans('{types}/{-module}::{-name}.name')), route('{-name}.index'));
}

public function index({Name}Table $table)
{
PageTitle::setTitle(trans('{types}/{-name}::{-name}.name'));
$this->pageTitle(trans('{types}/{-module}::{-name}.name'));

return $table->renderTable();
}

public function create()
{
PageTitle::setTitle(trans('{types}/{-name}::{-name}.create'));
$this->pageTitle(trans('{types}/{-module}::{-name}.create'));

return {Name}Form::create()->renderForm();
}
Expand All @@ -48,7 +48,7 @@ class {Name}Controller extends BaseController

public function edit({Name} ${+name})
{
PageTitle::setTitle(trans('core/base::forms.edit_item', ['name' => ${+name}->name]));
$this->pageTitle(trans('core/base::forms.edit_item', ['name' => ${+name}->name]));

return {Name}Form::createFromModel(${+name})->renderForm();
}
Expand Down

0 comments on commit 13ce398

Please sign in to comment.