Botanic release
This commit is contained in:
35
app/Datatables/Botanic/GenresDataTable.php
Normal file
35
app/Datatables/Botanic/GenresDataTable.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\DataTables\Botanic;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\DataTables\ParentDataTable as DataTable;
|
||||
use App\Models\Botanic\Genre;
|
||||
|
||||
class GenresDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'Genres';
|
||||
|
||||
public function query(Genre $model)
|
||||
{
|
||||
$model = $model::with('family')->withCount('species');
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('alias'),
|
||||
Column::make('latin'),
|
||||
Column::make('family.name'),
|
||||
Column::make('species_count')->title('Nb Espèces'),
|
||||
Column::computed('action')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->width(120)
|
||||
->addClass('text-center'),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user