I'm trying to call a static function with a varible name from a class.
The desired outcome:
class Controller extends Controller {
public $model = 'ModelName';
public function index() {
$woot = $this->model::find('');
var_dump($woot);
}
}
This works:
$class = 'ClassName';
$object = $class::find($parameters);
This works too:
$class = new Model();
$object = $class::find($params);
I am trying to define the new class name inside the current class, and call find as a static function from the current model.
Any ideas how it's possible, without creating a new object, using __set
, or declaring a local variable in the function?