feat(article): add article views column to datatable, refresh after article deletion, and correct 'Cuplikasn' typo in article form.

This commit is contained in:
Yoga Pangestu 2025-12-11 19:53:57 +07:00
parent 1c356d9fcc
commit ff775920ef
3 changed files with 9 additions and 2 deletions

View File

@ -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']);
}
}

View File

@ -23,6 +23,8 @@ public function delete(Article $article): void
$article->delete();
$this->dispatch('refreshDatatable');
$this->toast('Artikel berhasil dihapus.');
Flux::modals()->close();

View File

@ -23,7 +23,7 @@
</flux:field>
<flux:field>
<flux:label>Cuplikasn <span class="text-red-500 ms-1">*</span></flux:label>
<flux:label>Cuplikan <span class="text-red-500 ms-1">*</span></flux:label>
<flux:editor wire:model="form.excerpt" placeholder="Masukkan inti artikel yang menarik"
auotocomplete="off" class="**:data-[slot=content]:min-h-[100px]!" />
<flux:error name="form.excerpt" />