55 lines
1.3 KiB
PHP
55 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Livewire\Studio\Catalog\Perfume;
|
|
|
|
use App\Models\Perfume;
|
|
use App\Traits\Authorization\WithAuthorization;
|
|
use App\Traits\Components\WithConfirmation;
|
|
use App\Traits\Components\WithToast;
|
|
use App\Traits\Notification\WithSubscribeNotification;
|
|
use App\Traits\Pricing\WithShowPrice;
|
|
use Flux\Flux;
|
|
use Livewire\Attributes\Title;
|
|
use Livewire\Component;
|
|
|
|
#[Title('Parfum')]
|
|
class Index extends Component
|
|
{
|
|
use WithAuthorization, WithConfirmation, WithShowPrice, WithSubscribeNotification, WithToast;
|
|
|
|
public function mount(): void
|
|
{
|
|
$hasNotification = request()->get('notification');
|
|
|
|
if ($hasNotification) {
|
|
$this->js(<<<'JS'
|
|
const url = new URL(window.location);
|
|
url.search = '';
|
|
window.history.replaceState({}, '', url);
|
|
JS);
|
|
|
|
$this->toast($hasNotification);
|
|
}
|
|
}
|
|
|
|
public function delete(Perfume $perfume)
|
|
{
|
|
$this->canOrAbort('delete perfume');
|
|
|
|
$perfume->delete();
|
|
|
|
$this->dispatch('refreshDatatable');
|
|
|
|
$this->toast('Parfum berhasil dihapus.');
|
|
|
|
Flux::modals()->close();
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
return view('livewire.studio.catalog.perfume.index', [
|
|
'pageTitle' => 'Parfum',
|
|
]);
|
|
}
|
|
}
|