Home > database >  getting "This page isn’t working right now" in laravel login page
getting "This page isn’t working right now" in laravel login page

Time:09-22

I have starter laravel app, when I access the login page, shows to me "This page isn’t working right now", I don't see any errors in my code my loginController:

<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

class LoginController extends Controller
{
    public function __construct()
    {
        $this->middleware(['auth']);
    }
    public function index(){
        return view('auth.login');
    }

    public function store(Request $request){
        dd($request->remember);
        $this->validate($request, [
            'email' => 'required|email',
            'password' => 'required',
        ]);
        if(!auth()->attempt($request->only('email', 'password'))){
            return back()->with('status', 'Invalid login details');
        }
        return redirect()->route('dashboard');
    }
}

login route in web.php file :

Route::get('/login', [LoginController::class, 'index'])->name('login');
Route::post('/login', [LoginController::class, 'store']);

important settings in the ENV file :

APP_DEBUG=true
APP_ENV=local

App debug in config/app.php

'debug' => (bool) env('APP_DEBUG', true),

I tried :

1

Clearing the chance

> php artisan config:cache
> php artisan config:clear

2

I restarted the app by :

> php artisan down 

then in few seconds

> php artisan up

"Make sure in your env config, there are no spaces, if you have a value with spaces make sure to enclose it with quotes (" ")." - @Dexter Bengil

-I'm sure

extra info:

there's no cookies used in the app
the link I try to access: http://l.v/login
PHP version: PHP 7.4.0
laravel version:

C:\laravel>php artisan --version
Laravel Framework 8.61.0

this is the error I get (ERR_NO : 302):
the error

I'm sorry if I include too much info in the question, if you need any info please tell me.

CodePudding user response:

I think you need to remove these lines:

public function __construct()
{
    $this->middleware(['auth']);
}

Because you force for auth middleware. You should not add auth middleware to the login page.

  • Related