Beautiful handcrafted components Livewire components that will take your productivity to the next level.
1class UsersOverview extends Component { 2 public function delete($userId) 3 { 4 $this->askForConfirmation( 5 callback: function() use ($userId) { 6 Gate::authorize('delete-user', $userId); 7 User::find($userId)?->delete(); 8 }, 9 prompt: [10 'title' => __('Warning! Destructive action'),11 'message' => __('Are you sure you want to delete this user?'),12 'confirm' => __('Yes, Delete'),13 'cancel' => __('Stop'),14 ],15 confirmPhrase: 'DELETE',16 theme: 'warning',17 );18 }19}