PhpStorm laravel 5 method not found

Im f * cking crazy whith PhpStorm when trying to fix a popular bug Method 'Bla bla' not found in class.

I searched the days on Google, hoping to find a way for this problem, but no luck.

Almost every topic I read points me to this laravel-ide helper, but after installing a thousand times (with the fresh laravel project), PhpStorm still doesn't recognize this damn method.

I also install laravel plugin in PhpStorm but still not working, what can I do now?

Here is my code.

<?php

namespace App\Http\Controllers;

use App\Article;
use App\Menu;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Requestst;
use Illuminate\Support\Facades\Input;

class PagesController extends Controller
{
    public function index()
    {
        $article = Article::latest('published_at')->get();
        $data = array(
            'articles' => $article
        );
        return view('pages.index' , compact($data));
    }

    public function contact()
    {
        return view('pages.contact');
    }

    public  function about()
    {
        return view('pages.about');
    }
}

Please, help.

+4
source share
1 answer

"php artisan ide-helper: models" → , "php artisan ide-helper: models" → , _ide_helper_models.php, .

_ide_helper_models.php class Article it work xD

/**
 * Add an "order by" clause for a timestamp to the query.
 *
 * @param string $column
 * @return \Illuminate\Database\Query\Builder|static 
 * @static 
 */
public static function latest($column = 'created_at'){
    return \Illuminate\Database\Query\Builder::latest($column);
}
0

Source: https://habr.com/ru/post/1618472/


All Articles