未找到列:1054未知列' 0'在' where子句' (SQL:从`admins`中选择*,其中`email` = bel@b.b和`0` = 0 limit 1)

时间:2018-03-07 08:11:38

标签: php mysql laravel laravel-5 laravel-5.5

  

Illuminate \ Database \ QueryException(42S22)SQLSTATE [42S22]:   未找到列:1054未知列' 0'在' where子句' (SQL:   select * from admins其中email = test@test.com和0 = 0 limit   1)

我在github的项目:https://github.com/belalmr/laravel_ecom 错误在哪里?!

Route::post('login', 'AdminLogin@dologin');
AdminLogin.php文件中的

public function dologin()
{
    $rememberme = request('remember') == 1 ? true : false;
    if (auth()->guard('admin')->attempt(['email' => request('email'), 'password' => request('password'), $rememberme])) {
        return view('admin.index');
    } else {
        session()->flash('error', trans('admin_lang.incorrect_information_login'));
        return redirect('admin.login');
    }
}

in class CreateAdminsTable

public function up()
{
    Schema::create('admins', function (Blueprint $table) {
        $table->increments('id');
        $table->string('name');
        $table->string('email')->unique();
        $table->string('password');
        $table->rememberToken();
        $table->timestamps();
    });
}

1 个答案:

答案 0 :(得分:0)

我认为由于'email'参数中明确提供了'password'attempt字段,rememberme应具有相同的结构:

attempt([
    'email' => request('email'), 
    'password' => request('password'), 
     // I don't know how this field is called in your table
     // so check your table and fix it if required
    'rememeber' => $rememberme,
]);