add offers count, & minor fixes code standards
This commit is contained in:
@@ -14,23 +14,21 @@ class VarietiesDataTable extends DataTable
|
||||
{
|
||||
// $model = $model::with('specie')->withCount('Articles')->select('botanic_varieties.*');
|
||||
$model = $model::joinRelationship('Specie')->select('botanic_varieties.*', 'botanic_species.name as specie_name')->with('Specie')->withCount('Articles');
|
||||
return self::buildQuery($model);
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn(
|
||||
'photo', function (Variety $variety) {
|
||||
$media = $variety->getFirstMedia();
|
||||
// dump($media);
|
||||
// return $media('thumb');
|
||||
return '';
|
||||
}
|
||||
)
|
||||
->editColumn('photo', function (Variety $variety) {
|
||||
$media = $variety->getFirstMedia();
|
||||
// dump($media);
|
||||
// return $media('thumb');
|
||||
return '';
|
||||
})
|
||||
->rawColumns(['photo', 'action']);
|
||||
return Parent::modifier($datatables);
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +39,7 @@ class VarietiesDataTable extends DataTable
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('articles_count')->title('Nb articles')->class('text-right')->searchable(false),
|
||||
Column::make('photo')->title('')->searchable(false)->orderable(false),
|
||||
self::makeColumnButtons(),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user