Laravel Trait' Illuminate \ Auth \ UserTrait'未找到

时间:2014-06-17 07:34:23

标签: php laravel laravel-4

我搜索了Google,但没有发现任何相关信息,我之前从未在Laravel中遇到此错误。

我没有修改我的用户模型,只是添加了hasOne关系。

我一直得到这个错误,我现在无法解决2小时

Trait 'Illuminate\Auth\UserTrait' not found 

我没碰到模特

用户模型

<?php

use Illuminate\Auth\UserTrait;
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableTrait;
use Illuminate\Auth\Reminders\RemindableInterface;

class User extends Eloquent implements UserInterface, RemindableInterface {

    use UserTrait, RemindableTrait;

    /**
     * The database table used by the model.
     *
     * @var string
     */
    protected $table = 'users';

    /**
     * The attributes excluded from the model's JSON form.
     *
     * @var array
     */
    protected $hidden = array('password', 'remember_token');


    public function metadata()
    {
        return $this->hasOne('Metadata');
    }

}

有人可以帮我一把吗?

1 个答案:

答案 0 :(得分:3)

听起来你需要升级到Laravel v4.2。

在v4.2之前没有引入Illuminate \ Auth \ UserTrait类。检查github上的change log

检查upgrade guides是否升级,因为还有一些其他更改可能会破坏您的应用。