I have an application in which you can choose between multiple customers.
Choosing a customer will generate following URL:
http://localhost:8000/customer/CUSTOMER_NAME
From there on, I would like to choose a specific sub-page (e.g.: the support page)
How do I generate the following link:
http://localhost:8000/customer/CUSTOMER_NAME/support
So far, I always lose my CUSTOMER_NAME parameter, and I do not know how to keep it.
The framework I use is Laravel 5.

Any ideas?
You shall do this by passing the url param to the view by
I believe you have something like this in your route
Route::get('customer/{id}', 'yourController@yourFunctionName');
Then, in your controller, you may have
public function yourFunctionName($id)
{
return view('yourViewName')->with('id', $id);
}
Then from your view can simply do this to generate a url like this
<a href="customer/{id}/support">Click here</a>
To have the url like below
http://yourprojectname/customer/18/support
Advice : Use the Primary key or any unique field rather than using name to avoid some future issues.
Also you shall use helpers to generate url's
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With