У меня проблемы с переопределением имени столбца таблицы при сбросе пароля на Laravel, потому что я использую email_admin в качестве столбцов, поэтому он выдал мне эту ошибку
Illuminate\Database\QueryException
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'email' in 'where clause' (SQL: select * from `admins` where `email` = admin@mail.com limit 1)
Забыли пароль контроллера
<?php
namespace App\Http\Controllers\AuthAdmin;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Password;
class ForgotPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset emails and
| includes a trait which assists in sending these notifications from
| your application to your users. Feel free to explore this trait.
|
*/
use SendsPasswordResetEmails;
public function __construct()
{
$this->middleware('guest:admin');
}
public function broker()
{
return Password::broker('admins');
}
/**
* Display the form to request a password reset link.
*
* @return \Illuminate\Http\Response
*/
public function showLinkRequestForm()
{
return view('authAdmin.passwords.email');
}
/**
* Send a reset link to the given user.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse
*/
public function sendResetLinkEmail(Request $request)
{
$this->validateEmail($request);
// We will send the password reset link to this user. Once we have attempted
// to send the link, we will examine the response then see the message we
// need to show to the user. Finally, we'll send out a proper response.
$response = $this->broker()->sendResetLink(
$this->credentials($request)
);
return $response == Password::RESET_LINK_SENT
? $this->sendResetLinkResponse($request, $response)
: $this->sendResetLinkFailedResponse($request, $response);
}
}
Модель администратора
<?php
namespace App;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use App\Notifications\AdminResetPasswordNotification;
class Admin extends Authenticatable
{
use Notifiable;
protected $guard = 'admin';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'nama_admin', 'nip_admin', 'email_admin', 'password_admin',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password_admin', 'remember_token',
];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
public function getAuthPassword()
{
return $this->password_admin;
}
public function sendPasswordResetNotification($token)
{
$this->notify(new AdminResetPasswordResetNotification);
}
}
Я не знаю, что делать. Я уже читал эту ссылку, которая открывается, когда я создаю этот Вопрос, но она вообще не работает. Пожалуйста, помогите Laravel Сбросить Пароль с использованием другого имени столбца
Laravel 5.4 - Сброс пароля для изменения столбца «email»