From ba616954cb13513772a248dc0b608770cde8c9aa Mon Sep 17 00:00:00 2001 From: Yoga Pangestu Date: Thu, 16 Oct 2025 22:18:10 +0700 Subject: [PATCH] feat(article): enhance article form with improved placeholders and default status value --- .../Datatable/Studio/Manage/ArticlesTable.php | 7 ++++++- app/Livewire/Forms/Studio/Manage/ArticleForm.php | 2 +- app/Models/Article.php | 2 +- .../livewire/studio/manage/article/form.blade.php | 12 ++++++------ 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/app/Livewire/Datatable/Studio/Manage/ArticlesTable.php b/app/Livewire/Datatable/Studio/Manage/ArticlesTable.php index 58ebdcf..557d8b4 100644 --- a/app/Livewire/Datatable/Studio/Manage/ArticlesTable.php +++ b/app/Livewire/Datatable/Studio/Manage/ArticlesTable.php @@ -3,6 +3,7 @@ namespace App\Livewire\Datatable\Studio\Manage; use App\Models\Article; +use App\Traits\Datatable\WithAppendColumn; use App\Traits\Datatable\WithConfiguration; use App\Traits\Datatable\WithPrependColumn; use App\Traits\WithMediaHandler; @@ -13,7 +14,7 @@ class ArticlesTable extends DataTableComponent { - use WithConfiguration, WithMediaHandler, WithPrependColumn; + use WithAppendColumn, WithConfiguration, WithMediaHandler, WithPrependColumn; protected $model = Article::class; @@ -30,6 +31,10 @@ public function columns(): array ) ->html(), + Column::make('Waktu Publish', 'published_at') + ->format(fn ($value) => formatDateTime($value)) + ->searchable(), + Column::make('Aksi') ->label(function ($row) { $actions = ''; diff --git a/app/Livewire/Forms/Studio/Manage/ArticleForm.php b/app/Livewire/Forms/Studio/Manage/ArticleForm.php index 62bff6e..184d4c9 100644 --- a/app/Livewire/Forms/Studio/Manage/ArticleForm.php +++ b/app/Livewire/Forms/Studio/Manage/ArticleForm.php @@ -21,7 +21,7 @@ class ArticleForm extends Form public string $content = ''; - public string $status = ''; + public string $status = '1'; public array $thumbnail = []; diff --git a/app/Models/Article.php b/app/Models/Article.php index 339d242..0f77d91 100644 --- a/app/Models/Article.php +++ b/app/Models/Article.php @@ -31,7 +31,7 @@ protected function casts(): array public function getSlugOptions(): SlugOptions { return SlugOptions::create() - ->generateSlugsFrom('name') + ->generateSlugsFrom('title') ->saveSlugsTo('slug'); } diff --git a/resources/views/livewire/studio/manage/article/form.blade.php b/resources/views/livewire/studio/manage/article/form.blade.php index 8952cbb..0c77b0d 100644 --- a/resources/views/livewire/studio/manage/article/form.blade.php +++ b/resources/views/livewire/studio/manage/article/form.blade.php @@ -17,22 +17,22 @@ Judul * - + Cuplikasn * - + Konten * - +