Dmitriy Skogorev Dmitriy Skogorev - 1 year ago 80
PHP Question

How to build path to route in laravel with parameter?

I have next route

Route::get('org/edit/{id}/', ['as' => 'org.edit', 'uses' => 'OrgController@edit']);

and then create link to this route by laravel blade template:

<a href="{{ route('org.edit', [$org->id]) }}" class="btn btn-primary"><span class="glyphicon glyphicon-edit"></span></a>

what i expects to see:


what i get:


what i'm doing wrong?

Answer Source

Try passing it as a key value pair.

{{ route('org.edit', ['id' => $org->id]) }}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download