parfum/app/Livewire/Studio/Master/User/Edit.php
Yoga Pangestu 700aa8f260 feat(trait): membuat trait untuk toast agar reusable
-mengubah cara menulis toast diubah menjadi memanggil toast yang ada
2025-10-02 20:13:03 +07:00

42 lines
845 B
PHP

<?php
namespace App\Livewire\Studio\Master\User;
use App\Livewire\Forms\Studio\Master\UserForm;
use App\Models\User;
use App\Traits\WithToast;
use App\Traits\WithUpdatedData;
use Livewire\Attributes\Title;
use Livewire\Component;
#[Title('Ubah Pegawai')]
class Edit extends Component
{
use WithToast, WithUpdatedData;
public UserForm $form;
public function mount(User $user)
{
$this->form->setUser($user);
}
public function save()
{
$this->form->update();
$this->dispatch('refreshDatatable');
$this->toast('Pegawai berhasil diperbarui.');
$this->redirectRoute('studio.master.user.index', navigate: true);
}
public function render()
{
return view('livewire.studio.master.user.form', [
'pageTitle' => 'Ubah Pegawai',
]);
}
}