I got a problem when I created a login in laravel where the columns in tbl_user are different from the basic practice

  Kiến thức lập trình

enter image description here

I want to create a login in Laravel, where the columns in my tbl_user are user_id,user_nama, user_email, user_password

but what I get from my code below is like the image above.

I am not allowed to change the column structure in the table.

here is the code I use

<?php

namespace AppHttpControllersAuth;

use AppHttpControllersController;
use IlluminateHttpRequest;
use IlluminateSupportFacadesAuth;

class LoginController extends Controller
{
    public function login(Request $request)
    {
        $request->validate([
            'user_email' => 'required|email',
            'user_password' => 'required',
        ]);

        $credentials = $request->only('user_email', 'user_password');

        if (Auth::attempt([
            'user_email'    => $request->user_email,
            'user_password' => $request->user_password,
        ])) {
            $request->session()->regenerate();

            return redirect()->intended(route('dashboard', absolute: false));
        }

        return back()->withErrors([
            'user_email' => 'The provided credentials do not match our records.',
        ])->onlyInput('user_email');
    }

}

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT