__call() public method

Dynamically pass missing methods to the user.
public __call ( string $method, array $parameters ) : mixed
$method string
$parameters array
return mixed
コード例 #1
0
ファイル: User.php プロジェクト: mikemand/User
 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);
 }