我想两条只使用两条路线和获取(mp3,视频,专辑或艺术家)。Laravel:54使用同一路线的一条路线
这里是我的尝试:(一组 “/”)
Route::get("mp3s", "[email protected]");
Route::get("mp3s/mp3/{slug}", "[email protected]");
Route::get("videos", "[email protected]");
Route::get("videos/video/{slug}", "[email protected]");
Route::get("albums", "[email protected]");
Route::get("albums/album/{slug}", "[email protected]");
Route::get("artists", "[email protected]");
Route::get("artists/artist/{slug}", "[email protected]");
我已经所著一个foreach,但:
我认为这是eachpage一种不好的做法。
我不能得到(MP3或专辑,..)在这里:
foreach (pts as $pt) {
Route::get($pt.'s', '[email protected]');
Route::get(("{$pt}s/$pt/{slug}"), "[email protected]");
}
是的,但我怎么能在这个控制器中获得“视频”? –
结帐我的回答更新 – hassan
似乎没问题!但是,在这个URL localhost:8000/admin/post/new' 404 :((( –