2014-01-22 38 views
0

我正在使用Zizaco Entrust的示例項目中工作。在hasRole()中使用Zizaco Entrust錯誤() - Laravel 4.1

所有通過作曲家進行了宣傳,並按照說明here

的問題是我在route.php獲得以下錯誤:

的Symfony \分量\調試\異常\ FatalErrorException 調用未定義的方法照亮\身份驗證\ GenericUser :: hasRole()

我使用Easy PHP用PHP 5.4.14版本和我的用戶模型爲:

<?php 

use Illuminate\Auth\UserInterface; 
use Illuminate\Auth\Reminders\RemindableInterface; 
use Zizaco\Entrust\HasRole; 

class User extends Eloquent implements UserInterface, RemindableInterface { 
    use HasRole; 

    /** 
    * 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'); 

    /** 
    * Get the unique identifier for the user. 
    * 
    * @return mixed 
    */ 


    public function getAuthIdentifier() 
    { 
     return $this->getKey(); 
    } 

    /** 
    * Get the password for the user. 
    * 
    * @return string 
    */ 
    public function getAuthPassword() 
    { 
     return $this->password; 
    } 

    /** 
    * Get the e-mail address where password reminders are sent. 
    * 
    * @return string 
    */ 
    public function getReminderEmail() 
    { 
     return $this->email; 
    } 

} 

感謝您的幫助我。

回答

0

您應該使用相同的表和類名稱。如下。

class User extends.... 
protected $table = 'user'; 
... 
相關問題