moe-lk /
bulk-upload
| 1 | <?php |
||
| 2 | |||
| 3 | |||
| 4 | namespace App\Permissions; |
||
| 5 | |||
| 6 | use App\Models\Security_group_user; |
||
| 7 | |||
| 8 | trait HasPermissionsTrait |
||
| 9 | { |
||
| 10 | public function roles(){ |
||
| 11 | return $this->belongsToMany(Security_group_user::class,'security_group_users'); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 12 | } |
||
| 13 | |||
| 14 | |||
| 15 | public function hasRole( ... $roles ) { |
||
| 16 | foreach ($roles as $role) { |
||
| 17 | if ($this->roles->contains('code', $role)) { |
||
| 18 | return true; |
||
| 19 | } |
||
| 20 | } |
||
| 21 | return false; |
||
| 22 | } |
||
| 23 | |||
| 24 | |||
| 25 | } |