Illuminate \ Database \ QueryException(42S22)SQLSTATE [42S22]: 未找到列:1054未知列' 0'在' where子句' (SQL: select * from
admins
其中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();
});
}
答案 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,
]);