Reputation: 15
I am trying get a value from the URL for example : websitename.com/dash/namehere
I have route :
Route::get('/dash/{id}', 'DashController@index' , function($id) {
return 'dash'.$id;
});
Then I have a section on the page I am trying to display as a title. I am currently using this:
@if (\Request::is('dash/1'))
<div class="pagetitle">[clientname]</div>
@endif
This works but I am thinking there is a better way to approach this. I am very new to this. I want to get the id from the url / site.com/dash/ {id} and use it in the HTML page as a Title header.
Upvotes: 0
Views: 1160
Reputation: 441
Use {{ request()->route('id') }}
in your blade to get the "id" parameter from the dash route.
Upvotes: 1