@foreach($users as $user)
@canImpersonate()
@canBeImpersonated($user)
<a href="{{ route('impersonate', $user->id) }}">Impersonate this user</a>
@endCanBeImpersonated
@endCanImpersonate
@endforeach
User model I only want super admin to be able to impersonate.
/**
* Allow authenticate of another users
* @return bool
*/
public function canImpersonate()
{
return $this->isSuperAdmin();
}
/**
* Allow authenticate of this user
* @return bool
*/
public function canBeImpersonated()
{
return !$this->isSuperAdmin();
}
Is there a cleaner way of checking both?
User model I only want super admin to be able to impersonate.