Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

235
Views
Laravel list routes in the view

How can I list routes specifically the api routes in my view?

For example These:

...api/user
...api/Information

The artisan command for example does list them like this:

php artisan route:list
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

In your controller you can get the list of routes using Artisan facade. I assume all your api routes have api string in its path.:

public function showRoutes($request) {
    $routes = Artisan::call('route:list', ['--path' => 'api']);
    return view('your_view', compact('routes'));  
}

Edit :

You can also use Route facades getRoutes method.

$routes = [];
foreach (\Route::getRoutes()->getIterator() as $route){
    if (strpos($route->uri, 'api') !== false){
        $routes[] = $route->uri;
    }
}
return view('your_view', compact('routes'));
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!