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

40 lines
936 B
PHP

<?php
namespace App\Livewire\Studio\Manage\Article;
use App\Models\Article;
use App\Traits\Authorization\WithAuthorization;
use App\Traits\Components\WithConfirmation;
use App\Traits\Components\WithToast;
use App\Traits\Notification\WithSubscribeNotification;
use Flux\Flux;
use Illuminate\Contracts\View\View;
use Livewire\Attributes\Title;
use Livewire\Component;
#[Title('Artikel')]
class Index extends Component
{
use WithAuthorization, WithConfirmation, WithSubscribeNotification, WithToast;
public function delete(Article $article): void
{
$this->canOrAbort('delete article');
$article->delete();
$this->dispatch('refreshDatatable');
$this->toast('Artikel berhasil dihapus.');
Flux::modals()->close();
}
public function render(): View
{
return view('livewire.studio.manage.article.index', [
'pageTitle' => 'Artikel',
]);
}
}