Skip to content

Routing


Available Completions

php
// Middleware completion
Route::middleware('auth')
    // Namespace completion
    ->namespace('App\Http\Controllers')
    ->group(function () {
        // Single action controller completion
        Route::get('/profile', 'EditProfileController')->name('profile.edit');
        // Controller and action completion
        Route::delete('/profile', 'ProfileController@destroy')->name('profile.destroy');
    });
    
// Namespace completion
Route::patch('/profile', 'App\Http\Controllers\ProfileController@update')
    // Middleware completion
    ->middleware('auth')
    ->name('profile.update');

// only / except for route resource completion
Route::resource('posts', PostController::class)->only([
    'index',
    'show',
]);

// Route name completion
route('profile.edit');

INFO

PhpStorm Refactoring, Find Usages and Go to Declaration features also work with controller class and method names.

WARNING

Refactoring for route names is unavailable for now.

Route files recognition

Laravel Idea analyzes RouteServiceProvider for Laravel (bootstrap/app.php file for Lumen) and tries to find all needed information about route files there:

  • route files
  • root namespaces
  • route name prefixes
  • etc.

For some complex cases when route files are included with non-standard way, helper phpDoc comments can be added there to have same completions: