parfum/app/Livewire/Studio/Manage/Article/Edit.php

44 lines
966 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->toast('Artikel berhasil diperbarui.');
$this->redirectRoute('studio.manage.article.index');
}
public function render(): View
{
return view('livewire.studio.manage.article.form', [
'pageTitle' => 'Ubah Artikel',
]);
}
}