404labfr / 404labfr/laravel-impersonate
Blade macro for both canImpersonate and canBeImpersonated
- Ngôn ngữ chính
- PHP
- Star
- 2.3k
- Fork
- 235
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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();
}
```
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Đánh giá
Issue này chưa được đánh giá.