src/Traits/HasPermissions.php
public function hasPermission($permission)
    {
        $permission = !is_string($permission) ?: Permission::where(['slug' => $permission])->first();

        if ($permission) {
            foreach ($this->permissions as $p) {
                if ($p->id == $permission->id) {
                    return true;
                }
            }
        }

        return false;
    }
public function hasPermission($permission)
    {
        $permission = !is_string($permission) ?: Permission::where(['slug' => $permission])->first();

        if ($permission) {
            foreach ($this->permissions as $p) {
                if ($p->id == $permission->id) {
                    return true;
                }
            }
        }

        return false;
    }
public function hasPermission ( $ permission ) { $ permission = ! is_string ( $ permission ) ? : Permission :: where ( [ 'slug' => $ permission ] ) -> first ( ) ; if ( $ permission ) { foreach ( $ this -> permissions as $ p ) { if ( $ p -> id == $ permission -> id ) { return true ; } } } return false ; }
Returns if the user has a permission.

@param mixed $permision

@return bool
Returns if the user has a permission .