- Forums
- laravel
- Laravel How To Get The Current Route Name From Url
Use this simple snippet to show you the name of the route in Laravel for any blade template [5275], Last Updated: Mon Jun 24, 2024
edw
Fri Dec 29, 2023
0 Comments
271 Visits
Get Route Name In Laravel Blade
Use this snippet inside a Laravel Blade Template:
Example Url: http://localhost:8000/shop/order/1?order=1
web.php
Route::get('/shop/order/{order}', function () {
return View::make('shop.pages.order');
})->name('order');
order.blade.php
{{Route::current()->getName()}}
Output: order
Hope that helps.