feat(article): enhance article form with improved placeholders and default status value

This commit is contained in:
Yoga Pangestu 2025-10-16 22:18:10 +07:00
parent 2b101764a8
commit ba616954cb
4 changed files with 14 additions and 9 deletions

View File

@ -3,6 +3,7 @@
namespace App\Livewire\Datatable\Studio\Manage; namespace App\Livewire\Datatable\Studio\Manage;
use App\Models\Article; use App\Models\Article;
use App\Traits\Datatable\WithAppendColumn;
use App\Traits\Datatable\WithConfiguration; use App\Traits\Datatable\WithConfiguration;
use App\Traits\Datatable\WithPrependColumn; use App\Traits\Datatable\WithPrependColumn;
use App\Traits\WithMediaHandler; use App\Traits\WithMediaHandler;
@ -13,7 +14,7 @@
class ArticlesTable extends DataTableComponent class ArticlesTable extends DataTableComponent
{ {
use WithConfiguration, WithMediaHandler, WithPrependColumn; use WithAppendColumn, WithConfiguration, WithMediaHandler, WithPrependColumn;
protected $model = Article::class; protected $model = Article::class;
@ -30,6 +31,10 @@ public function columns(): array
) )
->html(), ->html(),
Column::make('Waktu Publish', 'published_at')
->format(fn ($value) => formatDateTime($value))
->searchable(),
Column::make('Aksi') Column::make('Aksi')
->label(function ($row) { ->label(function ($row) {
$actions = ''; $actions = '';

View File

@ -21,7 +21,7 @@ class ArticleForm extends Form
public string $content = ''; public string $content = '';
public string $status = ''; public string $status = '1';
public array $thumbnail = []; public array $thumbnail = [];

View File

@ -31,7 +31,7 @@ protected function casts(): array
public function getSlugOptions(): SlugOptions public function getSlugOptions(): SlugOptions
{ {
return SlugOptions::create() return SlugOptions::create()
->generateSlugsFrom('name') ->generateSlugsFrom('title')
->saveSlugsTo('slug'); ->saveSlugsTo('slug');
} }

View File

@ -17,22 +17,22 @@
<flux:card class="space-y-6 p-6"> <flux:card class="space-y-6 p-6">
<flux:field> <flux:field>
<flux:label>Judul <span class="text-red-500 ms-1">*</span></flux:label> <flux:label>Judul <span class="text-red-500 ms-1">*</span></flux:label>
<flux:input placeholder="Masukkan judul" wire:model.live.debounce.500ms="form.title" <flux:input placeholder="Contoh: Tips Memilih Parfum"
autofocus autocomplete="off" /> wire:model.live.debounce.500ms="form.title" autofocus autocomplete="off" />
<flux:error name="form.title" /> <flux:error name="form.title" />
</flux:field> </flux:field>
<flux:field> <flux:field>
<flux:label>Cuplikasn <span class="text-red-500 ms-1">*</span></flux:label> <flux:label>Cuplikasn <span class="text-red-500 ms-1">*</span></flux:label>
<flux:editor wire:model="form.excerpt" placeholder="Masukkan cuplikan" auotocomplete="off" <flux:editor wire:model="form.excerpt" placeholder="Masukan inti artikel yang menarik"
class="**:data-[slot=content]:min-h-[100px]!" /> auotocomplete="off" class="**:data-[slot=content]:min-h-[100px]!" />
<flux:error name="form.excerpt" /> <flux:error name="form.excerpt" />
</flux:field> </flux:field>
<flux:field> <flux:field>
<flux:label>Konten <span class="text-red-500 ms-1">*</span></flux:label> <flux:label>Konten <span class="text-red-500 ms-1">*</span></flux:label>
<flux:editor wire:model="form.content" placeholder="Masukkan konten" auotocomplete="off" <flux:editor wire:model="form.content" placeholder="Masukan konten artikel"
class="**:data-[slot=content]:min-h-[100px]!" /> auotocomplete="off" class="**:data-[slot=content]:min-h-[100px]!" />
<flux:error name="form.content" /> <flux:error name="form.content" />
</flux:field> </flux:field>
</flux:card> </flux:card>