App\Models\Image 出错?
添加图片接口之前是正常的,今天调接口突然报错 Image 找不到,打开phpstorm发现语法报错
将原来的写法
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Image extends Model
{
//
protected $fillable = ['type', 'path'];
public function user()
{
return $this->belongsTo(User::class);
}
}
改成
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Image extends Model
{
//
protected $fillable = array('type', 'path');
public function user()
{
return $this->belongsTo(\App\Models\User);
}
}
就好了,上周重装了homestead,php现在是7.2,原来的写法7.2不适用了吗
推荐文章: