Skip to main content
Category:

Quickly Navigate from Routes file to Controller in Laravel


Instead of routing like this:


Route::get('page', 'PageController@action');


You can specify the Controller as a class:


Route::get('page', [\App\Http\Controllers\PageController::class, 'action']);

or 

use \App\Http\Controllers\PageController;

Route::get('page', [PageController::class, 'action']);

 

Then you will be able to click on “PageController” , and navigate directly to Controller, instead of searching for it manually.

Riadh Rahmi

Senior Web Developer PHP/Drupal & Laravel

I am a senior web developer, I have experience in planning and developing large scale dynamic web solutions especially in Drupal & Laravel.

Web Posts

Search

Page Facebook