Naib Sorion
Naib Sorion

Reputation: 504

Get URL parameters in laravel

In my route I have like this

Route::get('/library/{id?}', 'LibraryController@index')->name('library');

and returning my url to http://localhost/dmb/library/2017

In my blade how can I check and display if I have that 2017 in my url?

Upvotes: 3

Views: 8621

Answers (1)

Bilal Ahmed
Bilal Ahmed

Reputation: 4066

this code will help you

if you want to get library then you should used

$segment = Request::segment(1);

for 2017 then used segment(2)

$segment = Request::segment(2);

Upvotes: 9

Related Questions