Preventing the admin from deleting himself
How do you prevent the admin from deleting himself ?
5 Replies
Solution
Are you using rules? You can add a false in it if the $user != Auth()->user()
The first idea worked.
The second idea also sounds good, but where in the code is the
rules
?
And a related Q:
In the Edit view:
Actions\DeleteAction::make()
How can I disable or not show the delete button for the admin?
like, inside this file:
I dont know how to get the id of the current user page.
How do you grab the {id}
from this url? {domain}/admin/users/{id}/edit
Once I know that I can :
Sorry I meant policies
https://laravel.com/docs/11.x/authorization#creating-policies