fixes
This commit is contained in:
@@ -15,7 +15,7 @@ class ArticlesDataTable extends DataTable
|
||||
|
||||
public function query(Article $model)
|
||||
{
|
||||
$model = $model::with(['article_nature', 'image'])->withCount(['categories', 'tags', 'offers']);
|
||||
$model = $model::with(['article_nature', 'image'])->withCount(['categories', 'images', 'offers', 'tags']);
|
||||
$model = self::filterByArticleNature($model);
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
@@ -35,7 +35,14 @@ class ArticlesDataTable extends DataTable
|
||||
->editColumn('article_nature.name', function (Article $article) {
|
||||
return $article->article_nature ? $article->article_nature->name : '';
|
||||
})
|
||||
->rawColumns(['thumb', 'action']);
|
||||
->editColumn('tags2', function (Article $article) {
|
||||
$html = '';
|
||||
foreach ($article->tags as $tag) {
|
||||
$html .= '<span class="btn btn-xs btn-secondary pb-2">' . $tag->slug . '</span> ';
|
||||
}
|
||||
return $html;
|
||||
})
|
||||
->rawColumns(['tags2', 'thumb', 'action']);
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
@@ -45,9 +52,11 @@ class ArticlesDataTable extends DataTable
|
||||
Column::make('article_nature.name')->title('Nature'),
|
||||
Column::make('thumb')->title('')->searchable(false)->orderable(false)->width(40)->class('text-center'),
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('tags_count')->title('Tags')->class('text-right')->searchable(false),
|
||||
Column::make('categories_count')->title('Rayons')->class('text-right')->searchable(false),
|
||||
Column::make('offers_count')->title('Offres')->class('text-right')->searchable(false),
|
||||
Column::make('tags2')->title('Tags')->searchable(false)->orderable(false),
|
||||
Column::make('tags_count')->title('#Tag')->class('text-right')->searchable(false),
|
||||
Column::make('categories_count')->title('#Ray')->class('text-right')->searchable(false),
|
||||
Column::make('offers_count')->title('#Ofr')->class('text-right')->searchable(false),
|
||||
Column::make('images_count')->title('#Pho')->class('text-right')->searchable(false),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user