Haehnchen / idea-php-laravel-plugin

Laravel Framework Plugin for PhpStorm / IntelliJ IDEA
MIT License
573 stars 108 forks source link

Navigating from route to controller not working #148

Open birendragurung opened 7 years ago

birendragurung commented 7 years ago

I have a grouped routes in my web.php file. I use Phpstorm and used laravel plugin along with laravel-ide-helper. The issue arises when I want to navigate to the controller method directly from my route declarations, but this is not working in my ide. Sometimes the controller methods with get routes can be navigated and sometimes only the post routes get navigated. But in this moment, neither of the routes are can be navigated to the controller methods. Is there any mistake that are making this inconsistency in my IDE helper?

adelf commented 7 years ago

@birendragurung could you provide part of the code from routes/web.php ?

adelf commented 7 years ago

And also versions of IDE and plugin.

birendragurung commented 7 years ago

Laravel plugin 0.9.1 PhpStorm 10.0.2

adelf commented 7 years ago

Sorry, but current version of plugin is 0.14.2... And routing was refactored a lot. And I think the last version works ok there.

birendragurung commented 7 years ago

Now i've updated the plugin. But still my get routes are not navigating to associated controller methods..

Anploe commented 6 years ago

Its a long time but i just faced the same issue. In my case i forgot to activate the plugin for the current Project

azdanov commented 6 years ago

I have a similar issue.

screen shot 2018-09-10 at 12 58 59
Version Info ```txt PhpStorm 2018.3 EAP Build #PS-183.2153.44, built on September 5, 2018 PhpStorm EAP User Expiration date: October 5, 2018 JRE: 1.8.0_152-release-1293-b10 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o macOS 10.13.6 Laravel Plugin v0.15 ```
kiwina commented 6 years ago

Had the same issue, just go in the plugin settings and set the router namespace ie: \App\Http\Controllers

azdanov commented 6 years ago

@kiwina Doesn't seem to work neither with \App\Http\Controllers or any other permutation.

screen shot 2018-09-11 at 04 54 03
adelf commented 6 years ago

@azdanov have you installed ide-helper and made artisan ide-helper:generate?

azdanov commented 6 years ago

@adelf I did. Although there are some issues as I've mentioned in https://github.com/barryvdh/laravel-ide-helper/issues/704.

adelf commented 6 years ago

I asked because I saw that get method is highlighted as unknown. Thats the reason. This plugin autocompletes the get, post and other methods of Route class.

azdanov commented 6 years ago

I see. Guess it's an issue with barryvdh/laravel-ide-helper.

This way is not supported?

<?php

use Illuminate\Support\Facades\Route;

Route::get('/', 'HomeController@index');
azdanov commented 6 years ago

There is a workaround as mentioned in https://github.com/barryvdh/laravel-ide-helper/issues/708#issuecomment-422837744. Not ideal, but it enables on click navigation in routes.

wensonsmith commented 5 years ago

After change _ide_helper.php

class Route extends \Illuminate\Support\Facades\Route {}

to

class Route extends Illuminate\Support\Facades\Route {}

Just remove the slash \, and restart phpStorm , it works for me .

But I don't understand why.

jithinlal commented 5 years ago

The method mentioned by @wensonsmith didn't help. Is there any way to resolve this issue?

km1001 commented 5 years ago

add this: use Illuminate\Support\Facades\Route;

Route::get('/show', 'IndexController@show');

rpounder commented 5 years ago

add this: use Illuminate\Support\Facades\Route;

Route::get('/show', 'IndexController@show');

That's a band-aid, not a solution

bapon3115 commented 5 years ago

bootstrap/compiled.php has to be cleared first, so run php artisan clear-compiled before generating.

php artisan clear-compiled then, php artisan ide-helper:generate

CodeLover254 commented 4 years ago

Did anyone find a long-lasting solution to this? Sometimes my IDE navigates, sometimes it doesn't.

cvvbay commented 4 years ago

Did anyone find a long-lasting solution to this? Sometimes my IDE navigates, sometimes it doesn't.

Same problem that i facing rigtht now.. sometime restart phpstorm also not the solution

cartes commented 4 years ago

Well, I got to upload some plug-ins: "Laravel", "Laravel Snippets" and "LaravelStorms". This worked for me. Hope was useful.

btxtiger commented 4 years ago

I've tried all options suggested here and it does not work. PhpStorm 2020.1 "laravel/framework": "^6.7", "barryvdh/laravel-ide-helper": "^2.6.7",

cartes commented 4 years ago

Try with composer install or npm install

adampatterson commented 3 years ago

I don't remember setting this up in the past but it worked for me now.

image

adampatterson commented 3 years ago

@btxtiger Did add the Router Namespace? That fixed it for me.

btxtiger commented 3 years ago

@adampatterson Geat!!! Finally adding the Router Namespace worked! I'm also generating helpers using php artisan ide-helper:generate && php artisan ide-helper:meta && php artisan ide-helper:models -N if that helps anyone.