Hi i m laravel fresher so i don't know How to set backend url dynamic
像 的 https://sample.com/admin 至 的 https://sample.com/somename
Route::group(['prefix' =>'admin','middleware' => 'Admin_kernal'], function ()
{
//code here
}
Thanking you.....
答案 0 :(得分:1)
了解route parameters。设置路线:
Route::get('{name}', 'SomeController@handle');
handle()
方法SomeController
:
public function handle($name) {
echo $name;
....
}
答案 1 :(得分:0)
您也可以像这样设置路线 -
Route::get('{name?}', 'SomeController@showView');
并使方法如 -
public function showFrontEndView($name=null)
{
if(View::exists($name))
{
return view($name);
}
else
{
return view('404');
}
}
您应该阅读routing laravel-5.4
你也可以在laravel 5.5中阅读resource controller laravel的新风味