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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
build
composer.lock
docs
vendor
coverage
.php-cs-fixer.cache
Expand Down
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,41 @@ or you can pass your own view and include the DataGrid blade file there:
return $dataGrid->render('admin.common.index');
}
```
## Available commands
###### Code related

- [**make**:datagrid](#make-datagrid) ~ Generates datagrid class
---
<a name="make-datagrid"/>

## `php artisan make:datagrid <-M|--model> <-F|--fields>`

Generates datagrid class, the generated class is placed in \App\DataGrids directory

- -M|--model name of the model to use
- -F|--fields the name of the fields of the comma separated: 'field1,field2,field3' or 'field1:label1,field2:label2,field3:label3'

Generated class

```php
class CategoriesDataGrid extends DataGrid
{

/**
* CategoriesDataGrid constructor.
*/
public function __construct()
{
$this->fromQuery(Category::query())
->column('id', 'ID', null, 50)
->column('name', 'Name')
}
}
```

#### Usage example

![php artisan make datagrid command](docs/images/php_artisan_make_datagrid.png)

## Frontend customisations

Expand Down
Binary file added docs/images/php_artisan_make_datagrid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.