Skip to content

Commit

Permalink
Fixed make:table <TableName> --model=<ModelNamespace> command
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthur LORENT committed Sep 26, 2022
1 parent 14d39bb commit af3f086
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [5.0.1](https://github.com/Okipa/laravel-table/compare/5.0.0...5.0.1)

2022-09-26

* Fixed `make:table <TableName> --model=<ModelNamespace>` command

## [5.0.0](https://github.com/Okipa/laravel-table/compare/4.0.4...5.0.0)

2022-09-21
Expand Down
7 changes: 4 additions & 3 deletions src/Console/Commands/stubs/table.model.stub
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ namespace DummyNamespace;

use DummyFullModelClass;
use Okipa\LaravelTable\Table;
use Okipa\LaravelTable\Column;
use Okipa\LaravelTable\RowActions\EditRowAction;
use Okipa\LaravelTable\RowActions\DestroyRowAction;
use Okipa\LaravelTable\Formatters\DateFormatter;
Expand All @@ -23,9 +24,9 @@ class DummyClass extends AbstractTableConfiguration
protected function columns(): array
{
return [
Column::make('id')->sortable();
Column::make('created_at')->format(new DateFormatter('d/m/Y H:i'))->sortable();
Column::make('updated_at')->format(new DateFormatter('d/m/Y H:i'))->sortable()->sortByDefault('desc');
Column::make('id')->sortable(),
Column::make('created_at')->format(new DateFormatter('d/m/Y H:i'))->sortable(),
Column::make('updated_at')->format(new DateFormatter('d/m/Y H:i'))->sortable()->sortByDefault('desc'),
];
}

Expand Down
7 changes: 4 additions & 3 deletions tests/Unit/MakeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public function it_can_make_table_with_model_option(): void
'namespace App\Tables;',
'use App\Models\User;',
'use Okipa\LaravelTable\Abstracts\AbstractTableConfiguration;',
'use Okipa\LaravelTable\Column;',
'use Okipa\LaravelTable\Formatters\DateFormatter;',
'use Okipa\LaravelTable\RowActions\DestroyRowAction;',
'use Okipa\LaravelTable\RowActions\EditRowAction;',
Expand All @@ -79,9 +80,9 @@ public function it_can_make_table_with_model_option(): void
'protected function columns(): array',
'{',
'return [',
'Column::make(\'id\')->sortable();',
'Column::make(\'created_at\')->format(new DateFormatter(\'d/m/Y H:i\'))->sortable();',
'Column::make(\'updated_at\')->format(new DateFormatter(\'d/m/Y H:i\'))->sortable()->sortByDefault(\'desc\');',
'Column::make(\'id\')->sortable(),',
'Column::make(\'created_at\')->format(new DateFormatter(\'d/m/Y H:i\'))->sortable(),',
'Column::make(\'updated_at\')->format(new DateFormatter(\'d/m/Y H:i\'))->sortable()->sortByDefault(\'desc\'),',
'];',
'}',
'protected function results(): array',
Expand Down

0 comments on commit af3f086

Please sign in to comment.