diff --git a/app/Livewire/Datatable/Manage/ArticlesTable.php b/app/Livewire/Datatable/Manage/ArticlesTable.php index 03bb2ab..447715c 100644 --- a/app/Livewire/Datatable/Manage/ArticlesTable.php +++ b/app/Livewire/Datatable/Manage/ArticlesTable.php @@ -35,6 +35,11 @@ public function columns(): array ->format(fn ($value) => formatDateTime($value)) ->searchable(), + Column::make('Dilihat', 'views') + ->format(fn ($value) => currency($value)) + ->searchable() + ->sortable(), + Column::make('Aksi') ->label(function ($row) { $actions = ''; @@ -61,6 +66,6 @@ public function columns(): array public function builder(): Builder { - return Article::select('articles.id', 'author_id', 'title', 'articles.status', 'published_at')->with(['author', 'author.employee']); + return Article::select('articles.id', 'author_id', 'title', 'articles.status', 'published_at', 'views')->with(['author', 'author.employee']); } } diff --git a/app/Livewire/Studio/Manage/Article/Index.php b/app/Livewire/Studio/Manage/Article/Index.php index 062bfc9..f5fb0be 100644 --- a/app/Livewire/Studio/Manage/Article/Index.php +++ b/app/Livewire/Studio/Manage/Article/Index.php @@ -23,6 +23,8 @@ public function delete(Article $article): void $article->delete(); + $this->dispatch('refreshDatatable'); + $this->toast('Artikel berhasil dihapus.'); Flux::modals()->close(); diff --git a/resources/views/livewire/studio/manage/article/form.blade.php b/resources/views/livewire/studio/manage/article/form.blade.php index 01af824..83a0c75 100644 --- a/resources/views/livewire/studio/manage/article/form.blade.php +++ b/resources/views/livewire/studio/manage/article/form.blade.php @@ -23,7 +23,7 @@ - Cuplikasn * + Cuplikan *