mardi 8 juin 2021

Once go to login page it redirecting to the 404 page using Laravel

I developed the backend function with Laravel and my URL call like https://www.exapmle.com/admin so it will check already login means it will go to the dashboard otherwise login page https://www.exapmle.com/login it's working fine but after login is success close the browser tab and again go to https://www.exapmle.com/login URL it's going to 404 error and if I go to this URL https://www.exapmle.com/admin it's going to the dashboard without any issue page I don't know why it's happening please help mean to fix this issue.

Login Controller

<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;

class LoginController extends Controller
{
    use AuthenticatesUsers;

    /**
     * Where to redirect users after login.
     *
     * @var string
     */
    protected $redirectTo = '/admin';
    

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('guest')->except('logout');
    }

    protected function logout(Request $request)
    {
        $this->guard()->logout();

        $request->session()->flush();

        $request->session()->regenerate();

        return redirect('/login');
    }

}


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire