Skip to content

Commit 13ce398

Browse files
Improve dev tool
1 parent 60fec2b commit 13ce398

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

src/Commands/PluginMakeCrudCommand.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,19 @@ protected function removeUnusedFiles(string $location): void
6565
$files = [
6666
Helper::joinPaths(['config', 'permissions.stub']),
6767
Helper::joinPaths(['routes', 'web.stub']),
68+
Helper::joinPaths(['helpers', 'helpers.stub']),
6869
Helper::joinPaths(['resources', 'views', '.gitkeep']),
6970
'composer.json',
70-
Helper::joinPaths(['src', 'Providers', '{Module}ServiceProvider.stub']),
71-
Helper::joinPaths(['src', 'Forms', 'Settings', '{Module}Form.stub']),
72-
Helper::joinPaths(['src', 'Http', 'Controllers', 'Settings', '{Module}Controller.stub']),
73-
Helper::joinPaths(['src', 'Http', 'Requests', 'Settings', '{Module}Request.stub']),
74-
Helper::joinPaths(['src', 'PanelSections', '{Module}PanelSection.stub']),
71+
Helper::joinPaths(['src', 'Providers', '{Name}ServiceProvider.stub']),
72+
Helper::joinPaths(['src', 'Forms', 'Settings', '{Name}Form.stub']),
73+
Helper::joinPaths(['src', 'Http', 'Controllers', 'Settings', '{Name}Controller.stub']),
74+
Helper::joinPaths(['src', 'Http', 'Requests', 'Settings', '{Name}Request.stub']),
75+
Helper::joinPaths(['src', 'PanelSections', '{Name}PanelSection.stub']),
7576
];
7677

7778
foreach ($files as $file) {
7879
File::delete(Helper::joinPaths([$location, $file]));
7980
}
80-
81-
File::deleteDirectory(Helper::joinPaths([$location, 'src', 'PanelSections', '']));
8281
}
8382

8483
public function getReplacements(string $replaceText): array

stubs/module/src/Http/Controllers/{Name}Controller.stub

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@ class {Name}Controller extends BaseController
1616
{
1717
$this
1818
->breadcrumb()
19-
->add(trans(trans('{types}/{-name}::{-name}.name')), route('{-name}.index'));
19+
->add(trans(trans('{types}/{-module}::{-name}.name')), route('{-name}.index'));
2020
}
2121

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

2626
return $table->renderTable();
2727
}
2828

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

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

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

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

0 commit comments

Comments
 (0)