GETパラメータの受け取り
パラメータ付きのURLからパラメーターの値を取得し、ビューで表示する
パラメーター付きURL▼
http://localhost/sample_request?value=aaa
Routing▼
<?php Route::get('/sample_request', 'SampleController@accept');
Controller▼
<?php //コントローラーはクエリパラメーターを取得し、取得した値をビューへ渡す。 class SampleController extends Controller { public function accept(Request $request) { $value = $request->input('value'); return view('index')->with('val', $value); } }
View▼
<p>パラメーターの値:{{ $val }}</p>