src/Defender/Traits/HasDefender.php
public function hasPermission($permission, $force = false)
    {
        $permissions = $this->getAllPermissions($force)->pluck('name')->toArray();

        if (strpos($permission, '*')) {
            $permission = substr($permission, 0, -2);

            return (bool) preg_grep('~'.$permission.'~', $permissions);
        }

        return in_array($permission, $permissions);
    }
public function hasPermission($permission, $force = false)
    {
        $permissions = $this->getAllPermissions($force)->pluck('name')->toArray();

        if (strpos($permission, '*')) {
            $permission = substr($permission, 0, -2);

            return (bool) preg_grep('~'.$permission.'~', $permissions);
        }

        return in_array($permission, $permissions);
    }
public function hasPermission ( $ permission , $ force = false ) { $ permissions = $ this -> getAllPermissions ( $ force ) -> pluck ( 'name' ) -> toArray ( ) ; if ( strpos ( $ permission , '*' ) ) { $ permission = substr ( $ permission , 0 , - 2 ) ; return ( bool ) preg_grep ( '~' . $ permission . '~' , $ permissions ) ; } return in_array ( $ permission , $ permissions ) ; }
Returns if the current user has the given permission.
User permissions override role permissions.

@param string $permission
@param bool   $force

@return bool
Returns if the current user has the given permission . User permissions override role permissions .