I've got a method that deletes a user from a company and would like to do a check to make sure the company will still have a admin left within it.
I'm using the method below, and the snippet is not working when adding a third parameter. How can I pass more than one variable to it?
$this->authorize('companyHasAdminAfterDelete', $privilege->company, $user );
Can you just perform a simple check before deleting the user to check how many people with admin
role are left?
If there's only one before delete
then you know that probably he should not be deleted etc.