You can use ::class
only on object
$controller_name = RollsController::class;
Route::get($PageController[2], [(new $controller_name)::class, $PageController[2]]);
or using reflection
$controller_name = RollsController::class;
try {
$oClass = new ReflectionClass($controller_name);
Route::get($PageController[2], [$oClass::class, $PageController[2]]);
} catch (ReflectionException $e) {
}
0 comments:
Post a Comment
Thanks