404labfr / 404labfr/laravel-impersonate

Blade macro for both canImpersonate and canBeImpersonated

オープン
#152 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る
enhancement good first issue
主要言語
PHP
スター
2.3k
フォーク
235
PR マージ指標
30日以内にマージされた PR はありません

説明

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();
}
```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。