我想将两个参数传递给URL

时间:2019-08-31 10:23:46

标签: php laravel laravel-5 laravel-5.8

我想使用路由助手传递两个参数
一个是线程ID,另一个是线程ID,所以我想同时传递

index.blade.php

@foreach($works as $work)
<tr>
<td><a href="{{route('work.edit', ['id' => $work->id], ['project' => $param->id])}}">{{$work->input_person}}</a></td>

web.php

Route::get('/work/edit/{id}/{project}', 'WorkController@edit')->name('work.edit');

偶然地,错误显示如下

Missing required parameters for [Route: work.edit] [URI: work/edit/{id}/{project}]. 

我不知道该怎么做

2 个答案:

答案 0 :(得分:2)

相同数组传递它。

<a href="{{ route('work.edit', ['id' => $work->id,'project' => $param->id])}}">

答案 1 :(得分:1)

尝试一下:

route('work.edit', ['id' => $work->id, 'project' => $param->id])