__call() public method

Dynamically pass missing methods to the user.
public __call ( string $method, array $parameters ) : mixed
$method string
$parameters array
return mixed
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);
 }