n00b
n00b

Reputation: 192

Routes in Laravel with parameters in URL

Let's say I would like to implement a route that accepts email and a reference id

email: [email protected]
ref_id: abcd1234

website.com/ticket/[email protected]&ref_id=abcd1234

how do I design this url in laravel? should I just use a get route?

Upvotes: 0

Views: 100

Answers (3)

Yves Kipondo
Yves Kipondo

Reputation: 5603

Route::get('/ticket/{email}/{id}', function(){
    // You controller code goes here
}

Or if you are using seperate controller for each model

Route::get('/ticket/{email}/{id}', 'TicketController@method_name');

Upvotes: 0

AddWeb Solution Pvt Ltd
AddWeb Solution Pvt Ltd

Reputation: 21681

you should try this:

Route::get('ticket/email={email}/ref_id={ref_id}', 'YourController@metodName');

Upvotes: 1

Darshan Jain
Darshan Jain

Reputation: 499

Route::get('ticket/{email}/{ref_id}', 'YourController@YourMethod');

Please visit this link for more details about routes.

Upvotes: 3

Related Questions