idea-php-laravel-plugin
idea-php-laravel-plugin copied to clipboard
Support routes goto in namespaced route groups
For example i have route service provider:
protected function mapApiRoutes()
{
Route::middleware('api')
->namespace($this->namespace . '\Api')
->group(base_path('routes/api.php'));
}
And i have route group:
Route::group([
'namespace' => 'Mirrors',
'prefix' => 'lk',
'middleware' => ['auth']
], function () {
// Cert numbers
Route::get('/cert_numbers', ['uses' => 'CertNumbersController@index']);
Route::post('/cert_numbers', ['uses' => 'CertNumbersController@import']);
});
The full path to controller is - App\Http\Controllers\Api\Mirrors\CertNumbersController. But there is no working goto for these routes. Autocomplete suggest to use Api\Mirrors\CertNumbersController instead.
Can be this fixed? Or any workaround? Or maybe solution can be placed in plugin config, e.g. "Route files" (+we need to support "namespace" parsing in the Route::group).
Workaround: remove ->namespace($this->namespace . '\Api') and add Route::group('namespace'=> 'Api') to the begin of api.php. It's very compicated to analyze route namespaces in these cases...
@adelf can i suggest to add some annotation to specify namespace in routes file? E.g.
/** @laravel-idea-route-namespace \App\Http\Controllers\Api */
I'm having this problem too. Where you able to find a workaround on it?