This is my route:
Route::get('{slug?}/{slug2?}/{slug3?}', 'PageController@show');
This is how I got the slug value in my service provider:
$this->app->request->route('slug2')
Somethings my url looks like base_url/slug or base_url/slug/slug2 or base_url/slug/slug2/slug3. I am looking for a laravel way to get the lastest slug always no matter how my url looks like. Is there a way to do that ?
Thx
Using this I can get the lastest slug from my url. But I am still looking for a better solution even If i have to change the route. This is the code:
use Illuminate\Support\Facades\Request;
....
Request::segment(count(Request::segments()))
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