Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Generators/DataTablesHtmlCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class DataTablesHtmlCommand extends DataTablesMakeCommand
*
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
*/
protected function buildClass($name)
protected function buildClass($name): string
{
$stub = $this->files->get($this->getStub());

Expand Down
12 changes: 6 additions & 6 deletions src/Generators/DataTablesMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function handle()
$dom = config('datatables-buttons.generator.dom', 'Bfrtip');

$this->call('datatables:html', [
'name' => $this->prepareHtmlBuilderName($this->getNameInput()),
'name' => $this->getDataTableBaseName(),
'--columns' => $this->option('columns') ?: $columns,
'--buttons' => $this->option('buttons') ?: $buttons,
'--dom' => $this->option('dom') ?: $dom,
Expand All @@ -65,7 +65,7 @@ public function handle()
*
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
*/
protected function buildClass($name)
protected function buildClass($name): string
{
$stub = parent::buildClass($name);

Expand All @@ -83,13 +83,13 @@ protected function buildClass($name)
}

/**
* Prepare html builder name from input.
* Get DataTable class base name without the suffix.
*
* @return string
*/
protected function prepareHtmlBuilderName(): string
protected function getDataTableBaseName(): string
{
return preg_replace('#datatable$#i', '', $this->getNameInput());
return (string) preg_replace('#datatable$#i', '', $this->getNameInput());
}

/**
Expand All @@ -99,7 +99,7 @@ protected function prepareHtmlBuilderName(): string
*/
protected function prepareModelName(): string
{
return basename(preg_replace('#datatable$#i', '', $this->getNameInput()));
return basename($this->getDataTableBaseName());
}

/**
Expand Down