public function hasPermission($permission)
    {   
        $permission = Permission::whereName($permission)->first();
        if (is_null($permission)){
            return false;
        }
        return $this->hasRole($permission->roles);
    }
public function hasPermission($permission)
    {   
        $permission = Permission::whereName($permission)->first();
        if (is_null($permission)){
            return false;
        }
        return $this->hasRole($permission->roles);
    }
public function hasPermission ( $ permission ) { $ permission = Permission :: whereName ( $ permission ) -> first ( ) ; if ( is_null ( $ permission ) ) { return false ; } return $ this -> hasRole ( $ permission -> roles ) ; }
Determine if the user may perform the given permission.

@param  Permission $permission
@return boolean
Determine if the user may perform the given permission .