56 lines
1.3 KiB
PHP
56 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Livewire\Studio\Catalog\Bottle;
|
|
|
|
use App\Models\Bottle;
|
|
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 Illuminate\Contracts\View\View;
|
|
use Livewire\Attributes\Title;
|
|
use Livewire\Component;
|
|
|
|
#[Title('Botol')]
|
|
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(Bottle $bottle): void
|
|
{
|
|
$this->canOrAbort('delete bottle');
|
|
|
|
$bottle->delete();
|
|
|
|
$this->dispatch('refreshDatatable');
|
|
|
|
$this->toast('Botol berhasil dihapus.');
|
|
|
|
Flux::modals()->close();
|
|
}
|
|
|
|
public function render(): View
|
|
{
|
|
return view('livewire.studio.catalog.bottle.index', [
|
|
'pageTitle' => 'Botol',
|
|
]);
|
|
}
|
|
}
|