字串變陣列
Route::get('/', PostController@index');
Route::get('posts', 'PostController@index');
Route::get('/posts/{id}', 'PostController@show');
陣列
Route::get('/', ['as'=>'home.index','uses'=>'PostController@index']);Route::get('posts', ['as'=>'post.index','uses'=>'PostController@index']);Route::get('posts/{id}', ['as'=>'post.show','uses'=>'PostController@show']);
index.blade.php
加入超連結
{{ route('posts.show', [$post->id]) }}
沒有留言:
張貼留言