Add relations in tables, add saving states for datatables, minor fixes
This commit is contained in:
@@ -14,9 +14,7 @@ class ArticlesDataTable extends DataTable
|
||||
|
||||
public function query(Article $model)
|
||||
{
|
||||
// $model = $model::with('Family')->select('shop_articles.*','family.name as family_name')->join('shop_article_families as family', 'family.id', '=', 'shop_articles.article_family_id')->groupBy('shop_articles.id');
|
||||
// $model = $model::with('article_nature')->select('shop_articles.*');
|
||||
$model = $model::with('article_nature')->joinRelationship('article_nature')->select('shop_articles.*','shop_article_natures.name as nature_name');
|
||||
$model = $model::with('article_nature')->withCount(['categories', 'tags'])->joinRelationship('article_nature');
|
||||
$model = self::filterByArticleNature($model);
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
@@ -30,8 +28,10 @@ class ArticlesDataTable extends DataTable
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('article_nature.name')->data('nature_name')->title('Nature'),
|
||||
Column::make('article_nature.name')->title('Nature'),
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('tags_count')->title('Tags')->class('text-right'),
|
||||
Column::make('categories_count')->title('Rayons')->class('text-right'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user