2014-03-03 39 views
1

當用戶登錄正確的用戶名密碼&然後提示錯誤如何解決laravel 4中的驗證問題?

ErrorException

參數1傳遞給 照亮\身份驗證\ EloquentUserProvider :: validateCredentials()必須照亮\身份驗證\的UserInterface的 實例,實例給定用戶的, 稱爲在 E:\ XAMPP \ htdocs中\ laravel \廠商\ laravel \框架\ SRC \照亮\驗證\上線316 Guard.php 和定義

有人知道問題出在哪?

回答

2

您的用戶模型必須實現的UserInterface其方法:

<?php namespace Illuminate\Auth; 

interface UserInterface { 

    /** 
    * Get the unique identifier for the user. 
    * 
    * @return mixed 
    */ 
    public function getAuthIdentifier(); 

    /** 
    * Get the password for the user. 
    * 
    * @return string 
    */ 
    public function getAuthPassword(); 

} 

所以它必須聲明爲類似

use Illuminate\Auth\UserInterface; 

class User extends Eloquent implements UserInterface { 

} 
+0

謝謝! @安東尼奧·卡洛斯·裏貝羅 –

0

,當您使用的用戶不同的模型也可能出現此錯誤(例如:member) 如果是這種情況,您需要使用相應的模型/數據庫表更新app/config/auth.php中的身份驗證模型和身份驗證表。