Php Laravel 5-如何在没有电子邮件确认的情况下进行身份验证?

Php Laravel 5-如何在没有电子邮件确认的情况下进行身份验证?,php,authentication,laravel-5,Php,Authentication,Laravel 5,我正在Laravel5中创建一个简单的身份验证系统。我有在LaaVell 4中编写的认证代码,我用它作为基础。p> 我的问题是 SQLSTATE[42S22]:未找到列:中的1054未知列“已确认” “where子句”SQL:select*从接收电子邮件的用户= myemail@gmail.com和已确认=1限值1 看起来Laravel正在查看我的电子邮件是否经过验证。但是我不需要为这个应用程序执行注册和验证过程。我的问题是,我如何告诉拉威尔不要担心电子邮件确认 我的身份验证代码如下所示: pu

我正在Laravel5中创建一个简单的身份验证系统。我有在LaaVell 4中编写的认证代码,我用它作为基础。p> 我的问题是

SQLSTATE[42S22]:未找到列:中的1054未知列“已确认” “where子句”SQL:select*从接收电子邮件的用户= myemail@gmail.com和已确认=1限值1

看起来Laravel正在查看我的电子邮件是否经过验证。但是我不需要为这个应用程序执行注册和验证过程。我的问题是,我如何告诉拉威尔不要担心电子邮件确认

我的身份验证代码如下所示:

public function postAuthenticate()
{
    // Fetch posted credentials

    $email = \Request::input('email');
    $password = \Request::input('password');
    $remember = \Request::has('_remember');

    $credentials = [
        'email' => $email,
        'password' => $password,
        'confirmed' => 1
    ];

    // Attempt to log in user
    if (\Auth::attempt($credentials, $remember))
    {
        return \Redirect::intended('dashboard');
    }

    // If this code was reached, it means that the user failed to authenticated.  
    // In this case, redirect back to the login page with errors.

    $messages = new Illuminate\Support\MessageBag;
    $messages->add('Authentication Error', 'Sign in failed.');


    return \Redirect::to('/login')
        ->withInput()   
        ->with('errors', $messages);
}
我的用户模型如下所示:

<?php namespace App;

use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;

class User extends Model implements AuthenticatableContract, CanResetPasswordContract {

    use Authenticatable, CanResetPassword;

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

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = ['name', 'email', 'password'];

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

}
最后,我的用户表迁移是:

<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration {

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function(Blueprint $table)
        {
            $table->increments('id');
            $table->string('name');
            $table->string('email')->unique();
            $table->string('password', 60);
            $table->rememberToken();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('users');
    }

}
谢谢

您必须从$credentials中删除'confirmed'=>1

例如:

$credentials = [
        'email' => $email,
        'password' => $password
];

我的疏忽太明显了!谢谢对我最好!这是我的第一个答案;