roles
roles copied to clipboard
hasRole and permission works with $key not $value
Override hasRole() in User model if using Laravel >= 5.3
/**
- Check if the user has role.
- @param int|string $role
- @return bool */ public function hasRole($role) { return $this->getRoles()->contains(function ($value, $key) use ($role) { return $role == $value->id || Str::is($role, $value->slug); }); }