Route的放置順序很重要
id限定格視為數字
//id限制格式Route::pattern('id', '[0-9]+');Route::get('/', 'PostController@index');Route::get('posts', 'PostController@index');Route::get('/posts/{id}', 'PostController@show'); Route::get('/test', function(){ $user = \App\Post::with('user')->find(1); dd($user);});
沒有留言:
張貼留言