我已经实现了这段代码并且它有效, 函数从视图文件返回/生成html,我将view()方法添加到控制器
//i'm ok with this and did works
Route::get('/page/{name}', function($name){
if(class_exists("App\Http\Controllers\\".$name."Ctrl")){
return App::make("App\Http\Controllers\\".$name."Ctrl")->view();
}
else{
return "Page tidak ditemukan";
}
});
现在我想在资源路径上实现此功能,但无法找到技术/方法以与上面相同的方式运行
Route::resource('/data/{name}', function($name){
//check first if controller exists
if(class_exists("App\Http\Controllers\\".$name."Ctrl")){
//need some Kind Of method or hack i presume
// so the request is processed as defined by the standar resource route
//
//NEED HELP ON THIS FUNCTIONALITY
//
}
else{
return "Page tidak ditemukan";
}
});