Eloquent ORM Code Hinting in PhpStorm

后端 未结 6 1542
再見小時候
再見小時候 2020-12-08 00:57

So I\'m just starting off with Laravel (using v5) and Eloquent. I\'m working on getting some basic APIs up and running and noticing that a lot of working methods don\'t show

6条回答
  •  伪装坚强ぢ
    2020-12-08 01:30

    Add in model PHPDoc@mixin

    /**
     * Class News
     * @property int $id
     * @property string $created_at
     * @property string $updated_at
     * @mixin \Eloquent
     * @package App
     */
    class News extends Model
    {
    
    }
    

    In PHPStorm works

    Or add to \Illuminate\Database\Eloquent\Model

    PHPDoc

    /**
      * @mixin \Eloquent
      */
    abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializable, QueueableEntity, UrlRoutable
    ...
    

提交回复
热议问题