404labfr / 404labfr/laravel-impersonate

Blade macro for both canImpersonate and canBeImpersonated

Đang mở
#152 0 bình luận 1 reaction 0 người được giao Xem trên GitHub
enhancement good first issue
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á.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.