su3158
su3158

Reputation: 613

I want to pass two parameters to the URL

I want to pass two parameters with the route helper
One is the thread ID and the other is less so I want to pass both

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');

Incidentally, the error appears like this

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

I don't have a good idea of ​​what to do

Upvotes: 0

Views: 85

Answers (2)

Rouhollah Mazarei
Rouhollah Mazarei

Reputation: 4153

Try this:

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

Upvotes: 1

Dilip Hirapara
Dilip Hirapara

Reputation: 15296

Pass it in the same array.

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

Upvotes: 2

Related Questions