Laravel 8 , Laravel 7 , Laravel , Laravel 6
Nicesnippets
218
18-02-2021
Now let's see exmple of how to get route list in controller in laravel. In this tutorial i will explain you step by step laravel get route:list in controller. we will learn how to get route:list in controller in laravel. you can easily get all route list in laravel application. i will also show how to get route:list in controller in laravel controller.
Let's see step by step process of how to get route:list in controller in laravel Here i will give three way to get route list in laravel controller method So let's see the bellow example.
Example 1
use Illuminate\Support\Facades\Route;
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function homePage()
{
$routesList = Route::getRoutes();
dd($routesList);
}
Example 2
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function homePage()
{
$routesList = \Route::getRoutes()->get();
dd($routesList);
}
Example 3
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function homePage()
{
\Artisan::call('route:list');
return \Artisan::output();
}
It will help you....