Search code examples
phplaravelphpstormlaravel-facade

Problems with laravel-ide-helper


I am going through the Laravel 5 Fundamentals Laracasts video set but am having some difficulties with Facades in my IDE (Phpstorm 8). I have a model which uses the Eloquent facade use Illuminate\Database\Eloquent\Model;

I have required the laravel-ide-helper composer require barryvdh/laravel-ide-helper, added the service provider to the providers array 'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider',, regenerated the docs and restarted my IDE, but with no success.

I have a Model decleration in my Controller $article = Article::findOrFail($id); but the findOrFail method is highlighted and flagged as Method 'findOrFail' not found in class App\Article.

I am new to Laravel and the concept of Facades but am lost and have been unable to find an existing answer for my problem.


Solution

  • Have you tried php artisan ide-helper:generate?

    If you have problems during generation, you could also just copy the pre-generated gist:

    curl -O "https://gist.githubusercontent.com/barryvdh/5227822/raw/811f21a14875887635bb3733aef32da51fa0501e/_ide_helper.php"
    

    Source: https://github.com/barryvdh/laravel-ide-helper