Add count function for images herited

This commit is contained in:
Ludovic CANDELLIER
2022-04-16 13:58:09 +02:00
parent ee148a27ed
commit 4d31b1682c
12 changed files with 105 additions and 47 deletions

View File

@@ -7,6 +7,7 @@ use Yajra\DataTables\Html\Column;
use App\Datatables\ParentDataTable as DataTable;
use App\Models\Shop\Article;
use App\Repositories\Shop\Articles;
use App\Repositories\Shop\Tags;
class ArticlesDataTable extends DataTable
{
@@ -75,7 +76,7 @@ class ArticlesDataTable extends DataTable
->editColumn('tags2', function (Article $article) {
$html = '';
foreach ($article->tags as $tag) {
$html .= '<span class="btn btn-xs btn-success pb-2">' . $tag->slug . '</span> ';
$html .= '<span class="btn btn-xs btn-success pb-2">' . Tags::getFullnameByTag($tag) . '</span> ';
}
return $html;
})
@@ -86,16 +87,16 @@ class ArticlesDataTable extends DataTable
protected function getColumns()
{
return [
Column::make('visible')->title('Visible')->searchable(false),
Column::make('homepage')->title('Accueil')->searchable(false),
Column::make('visible')->title('Visible')->searchable(false)->width(50),
Column::make('homepage')->title('Accueil')->searchable(false)->width(50),
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('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),
Column::make('tags_count')->title('#Tag')->class('text-right')->searchable(false)->width(40),
Column::make('categories_count')->title('#Ray')->class('text-right')->searchable(false)->width(40),
Column::make('offers_count')->title('#Ofr')->class('text-right')->searchable(false)->width(40),
Column::make('images_count')->title('#Pho')->class('text-right')->searchable(false)->width(40),
$this->makeColumnButtons(),
];
}