Please Disable Your Browser Adblock Extension for our site and Refresh This Page!

our ads are user friendly, we do not serve popup ads. We serve responsible ads!

Refresh Page
Skip to main content
On . By CodimTh
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.

Comments

Add new comment

Restricted HTML

Riadh Rahmi

Senior Web Developer (Drupal & Laravel)

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

Web Posts

Search

Page Facebook