PHPStorm is not recognizing methods of my Model class in Laravel 5.0 [duplicate]

If you want a class extending Model to recognize Eloquent methods, just add the following in the top PHPDoc comment on the class:

@mixin Eloquent

Example:

<?php namespace App;

use Carbon\Carbon;
use Eloquent;
use Illuminate\Database\Eloquent\Model;

/**
 * Post
 *
 * @mixin Eloquent
 */
class Post extends Model {

Edit Laravel 6+ (Last tested on 9.41.0)

use Illuminate\Database\Eloquent\Builder;

/**
 * @mixin Builder
 */

Note:
Most of you probably are using ide-helper for Laravel, therefore this @mixin attribute is automatically generated for model Classes.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)