parfum/app/Livewire/Studio/Manage/Article/Edit.php
Yoga Pangestu 4d3cef520b feat(article): implementasi testing
- kasih return type
- kasih otorisasi untuk delete
-  type di otorisasi table
2025-12-10 13:48:41 +07:00

46 lines
1012 B
PHP

<?php
namespace App\Livewire\Studio\Manage\Article;
use App\Livewire\Forms\Studio\Manage\ArticleForm;
use App\Models\Article;
use App\Traits\WithAuthorization;
use App\Traits\WithToast;
use App\Traits\WithUpdatedData;
use Illuminate\Contracts\View\View;
use Livewire\Attributes\Title;
use Livewire\Component;
#[Title('Ubah Artikel')]
class Edit extends Component
{
use WithAuthorization, WithToast, WithUpdatedData;
public ArticleForm $form;
public function mount(Article $article): void
{
$this->form->setArticle($article);
}
public function save(): void
{
$this->canOrAbort('update article');
$this->form->update();
$this->dispatch('refreshDatatable');
$this->toast('Artikel berhasil diperbarui.');
$this->redirectRoute('studio.manage.article.index');
}
public function render(): View
{
return view('livewire.studio.manage.article.form', [
'pageTitle' => 'Ubah Artikel',
]);
}
}