如何删除下面显示的错误:( laravel框架)

时间:2017-07-26 10:21:14

标签: php laravel-4.2

我已经查看了很多文档。我正在尝试登录,但它无法正常工作。显示错误。我不知道原因。我是laravel的新手

这是我的控制器代码

    public function do_login()
    {
        $credentials = [
        'username'=>Input::get('username'),
        'password'=>Input::get('password')
    ]; 
    $rules = [
        'username' => 'required',
        'password'=>'required'
    ];

    //validating the credentials.
    $validator = Validator::make($credentials,$rules);

    //in case the credentials are valid. Try to login the user.
    if($validator->passes())
    {
        if (Auth::attempt($credentials))
        {
            //if successfull redirect the user 
            return Redirect::to('home');
        }
        else
        {
            //else send back the login failure message.
            return Redirect::back()->withInput()->with('failure','username or password is invalid!');
        } 
    }
    else
    {
        //send back the validation errors.
         return Redirect::back()->withErrors($validator)->withInput();
    }

}      

这是我的型号代码:

    <?php namespace LARAVEL\laravel_1st_project\models\UserModel;

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

    class UserModel extends \Eloquent implements UserInterface , RemindableInterface
    {
        public $table = "user";
        protected $primaryKey = 'employee_id';

        //public $timestamps = false;
    }

这是我的app \ config \ auth.php:

  'model' => 'LARAVEL\laravel_1st_project\UserModel',   

  'table' => 'user',

'reminder' => array(

    'email' => 'email.auth.reminder',

    'table' => 'password_reminders',

    'expire' => 60,

),

错误:   & finally this is the error um still facing

0 个答案:

没有答案