Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass multiple arguments with url (routing) in laravel 5.1

LARAVEL 5.1

I want to edit my table which having ID and TktID.

I want to pass this two parameters to edit method of my TestController.

My link:

<a href="/sig/edit?id={{$value->id}}&ticketid={{$value->ticketid}}" title="Edit signature">

My route.php

Route::get('sig/edit{id}{ticketid}','TicketsController@edit');

edit method of controller:

 public function edit($id, $ticketid)
    {
        //
    }

How do I pass here two arguments in route.php to controller.

like image 880
Rajendra Avatar asked Dec 11 '15 06:12

Rajendra


1 Answers

You forget end bracket

You have error in your routes.php file:

Route::get('sig/edit{id}{ticketid}', 'TicketsController@edit');

Should be:

Route::get('sig/edit/{id}/{ticketid}', 'TicketsController@edit');

Notice the forward slash after edit and id.

And in the view it should be either of the following:

<a href="{{ url('sig/edit/ ' . $value->id . '/' . $value->ticketid .')}}" title="Edit signature">

Or

<a href="/sig/edit/{$value->id}/{$value->ticketid}" title="Edit signature">

I hope this helps you out. Cheers.

like image 127
Saiyan Prince Avatar answered Oct 05 '22 23:10

Saiyan Prince