In this example, I will show you how to check the current route used along with the request. Sometimes we would like to determine if the current request was routed to a given named route, then we can use the named method on a Route instance. Let's see how to check the requested route:

<?php

if ($request->route()->named('profile')) {
   //
}

 

In the above example, we are checking whether the requested route is profile or not. 

 

Read also: How To Use Regular Expression In Laravel Route

 

Hope it can help you.

Category : #laravel

Tags : #laravel , #laravel routing