laravel-idea / plugin

Laravel Idea plugin for PhpStorm
https://laravel-idea.com/
172 stars 7 forks source link

[Feature Request]: Click to go to route controller action in Lumen with custom namespace #841

Open smares opened 1 year ago

smares commented 1 year ago

Feature Description

In a Lumen project (correctly identified as Lumen 8.3), I have the following route definition:

$groupSettings = [
    'namespace' => '\App\Http\Candidates\Controllers',
    'middleware' => [
        $corsMiddleware,
    ],
];

$router->group($groupSettings, function () use ($router) {
    $router->get('/me', 'CandidateController@show');
    // ...
});

However, I cannot click on CandidateController@show to have the IDE take me to that action. Anything you (or I) can do about it?

adelf commented 1 year ago

Hi.

$router->group([
    'namespace' => '\App\Http\Candidates\Controllers',
    'middleware' => [
        $corsMiddleware,
    ],
], function () use ($router) {
    $router->get('/me', 'CandidateController@show');
    // ...
});

It should work like that. Currently, Laravel Idea can't parse group config extracted to variable.

smares commented 1 year ago

Just tried that, but it didn't work. Do I have to trigger re-indexing or something?

adelf commented 1 year ago

Could you show how you register this route file in the bootstrap/app.php?

smares commented 1 year ago

It's registered dynamically based on an environment value. app.php loads routes/web.php and in web.php there's a switch. Based on that, it requires the proper route file.