404labfr / 404labfr/laravel-impersonate
Blade macro for both canImpersonate and canBeImpersonated
- Langage dominant
- PHP
- Étoiles
- 2.3k
- Forks
- 235
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
Is there a cleaner way of checking both?
```
@foreach($users as $user)
@canImpersonate()
@canBeImpersonated($user)
Impersonate this user
@endCanBeImpersonated
@endCanImpersonate
@endforeach
```
User model I only want super admin to be able to impersonate.
```php
/**
* 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();
}
```
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Évaluation
Cette issue n'a pas encore été évaluée.