0
我需要在我的表單中使用GET才能生成url查詢字符串,但我也需要在我的路由中使用模型id。基本上,我想用表單提交生成的url查詢字符串來擴展show($ id)方法。但它沒有得到id。 (POST方法沒有得到它的。)Laravel 5:使用GET方法綁定模型時無法獲取id
這是我有:
fund.blade.php
{!! Form::model($fund, ['route' => 'funds.getQuery', 'method' => 'get'], $fund->id) !!}
{!! Form::select('from', $years) !!}
{!! Form::select('to', $years) !!}
{!! Form::submit('Submit') !!}
{!! Form::close() !!}
routes.php文件
Route::get('funds/test/{funds}', [ 'as' => 'funds.getQuery', function($id){
$to = Input::get('to');
$from = Input::get('from');
$donations = Donation::whereBetween('Date_Submitted_Adjusted', [
new Carbon($to),
new Carbon($from)
])
->orderBy('Date_Submitted_Adjusted', 'asc')
->get();
$urlString = url('funds', $parameters = [
'id' => $id,
'from' => $from,
'to' => $to
]);
return $urlString;
}]);
我的節目/ {id}方法正常工作。我究竟做錯了什麼?