Merron Hights on thefic () Method ..
< /p>
extable asdisticable and extrable and affice as ad addrends and extred extable. Вот что я сделал:
model < /strong> < /p>
Код: Выделить всё
namespace App\Models;
use Illuminate\Support\Facades\Hash;
use Illuminate\Notifications\Notifiable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
class Office extends Authenticatable
{
use HasFactory, Notifiable;
protected $table = 'tbl_admin_user';
protected $primaryKey = 'admin_user_id';
public $incrementing = true;
public $keyType = 'int';
protected $fillable = [
// other column names
'admin_user_email_id',
'admin_user_password',
// other column names
'admin_updated_on',
'admin_created_on',
];
// Use customized field name
public function getAuthIdentifierName() {
return 'admin_user_email_id';
}
// Gets the hashed password
public function getAuthPassword() {
return $this->admin_user_password;
}
public $timestamps = false;
}
// Begin::Authenticate login
public function authenticateOfficeLogin(Request $request) {
// validate
$validate = $request->validate([
'admin_user_email_id' => 'required|email',
'admin_user_password' => 'required'
]);
// Store credentials
$credentials = [
'admin_user_email_id' => $validate['admin_user_email_id'],
'password' => $validate['admin_user_password'],
'admin_user_status' => 1,
];
$user = Office::where('admin_user_email_id', $request->admin_user_email_id)->first(); // Gets the matching data
// Check if user is authenticated
if($user) {
$authenticate = Auth::guard('admin')->attempt($credentials); // Here i got the error
// if authenticated
if($authenticate) {
return redirect()->route('office.dashboard')->with('success','Logged In Successfully!'); // redirect to the dashboard
}
}
}
// End::Authenticate login
< /code>
Что я пробовал:
очищенная конфигурация и кэш маршрутов с использованием PHP Artisan Config: Clear, Route: Clear и Cache: Clear и даже пробова оптимизации: Clear. < /p>
Добавлено log :: info (). Перед Auth :: попытка (). Hash :: check () внутри dd () перед вызовом (), и он на данный момент вернулся.
Подробнее здесь: https://stackoverflow.com/questions/795 ... a-custom-p