Cartalyst\Sentinel\Users\EloquentUser::__call PHP Method

__call() public method

Dynamically pass missing methods to the user.
public __call ( string $method, array $parameters ) : mixed
$method string
$parameters array
return mixed
    public function __call($method, $parameters)
    {
        $methods = ['hasAccess', 'hasAnyAccess'];
        if (in_array($method, $methods)) {
            $permissions = $this->getPermissionsInstance();
            return call_user_func_array([$permissions, $method], $parameters);
        }
        return parent::__call($method, $parameters);
    }

Usage Example

Example #1
0
 public function __call($method, $parameters)
 {
     $class_name = class_basename($this);
     #i: Convert array to dot notation
     $config = implode('.', ['relations', $class_name, $method]);
     #i: Relation method resolver
     if (Config::has($config)) {
         $function = Config::get($config);
         return $function($this);
     }
     #i: No relation found, return the call to parent (Eloquent) to handle it.
     return parent::__call($method, $parameters);
 }