Laravel deals with different types of routes. There are multiple route types used in Laravel applications. Each route is used for a different purpose. Some return parameters, while some return views with parameters. Lets see how to check the route type in Laravel. This article tells about how to use the list method to check the route type in Laravel. Let’s go through some code snippets to explain the function use.
The route:list command is used to show a list of all the registered routes for the application. This command will display the domain, method, URI, and name.
The example below demonstrates how to use the command without adding any options:
php artisan route:list
This will generate a table that shows the Domain, Method, URI, Name, Action, and Middleware used for that route.
However, we can also pass optional parameters to display filtered results. For example:
php artisan route:list --name=video
Therefore, this will show results that only have the Name attribute as ‘video’.
Similarly, we can pass other commands like –method=GET instead of –name=video, and filter results to show routes that use the GET method used.
The basic route:list command can be passed with many filtering parameters to check the route type and other route details in Laravel.