@habte is that refreshed the page or returned back to the previous page?
Do you get any error messages?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
In my laravel project I created my own login page in such way controlller
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests\LoginRequest;
use Illuminate\Support\Facades\Auth;
class LoginController extends Controller
{
/**
* Display login page.
*
* @return Renderable
*/
public function index()
{
return view('auth.login');
}
/**
* Handle account login request
*
* @param LoginRequest $request
*
* @return \Illuminate\Http\Response
*/
public function postLogin(Request $request)
{
dump( $request);
$request->validate([
'email' => 'required',
'password' => 'required',
]);
$credentials = $request->only('email', 'password');
if (Auth::attempt($credentials)) {
return redirect()->intended('home')
->withSuccess('You have Successfully loggedin');
}
return redirect("login")->withSuccess('Oppes! You have entered invalid credentials');
}
/**
* Handle response after user authenticated
*
* @param Request $request
* @param Auth $user
*
* @return \Illuminate\Http\Response
*/
protected function authenticated(Request $request, $user)
{
return redirect()->home();
}
}
route
Route::get('login', [App\Http\Controllers\LoginController::class,'index'])->name('login');
Route::post('post-login', [App\Http\Controllers\LoginController::class,'postLogin'])->name('login.post');
view
@extends('layouts.app')
@section('content')
<main class="login-form">
<div class="cotainer">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">Login</div>
<div class="card-body">
<form action="{{ route('login.post') }}" method="POST">
@csrf
<div class="form-group row">
<label for="email_address" class="col-md-4 col-form-label text-md-right">E-Mail Address</label>
<div class="col-md-6">
<input type="text" id="email_address" class="form-control" name="email" required autofocus>
@if ($errors->has('email'))
<span class="text-danger">{{ $errors->first('email') }}</span>
@endif
</div>
</div>
<div class="form-group row">
<label for="password" class="col-md-4 col-form-label text-md-right">Password</label>
<div class="col-md-6">
<input type="password" id="password" class="form-control" name="password" required>
@if ($errors->has('password'))
<span class="text-danger">{{ $errors->first('password') }}</span>
@endif
</div>
</div>
<div class="form-group row">
<div class="col-md-6 offset-md-4">
<div class="checkbox">
<label>
<input type="checkbox" name="remember"> Remember Me
</label>
</div>
</div>
</div>
<div class="col-md-6 offset-md-4">
<button type="submit" class="btn btn-primary">
Login
</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</main>
@endsection
but after i click the login button ,it refresh the page and still it is landing in login page i don't know why it is not working ? anyone who can help me please?
@habte comment out the majority of the routes, but leave login routes and at least one place to redirect to after login.
Now try to login and see if that works.
Without having your app on my computer to test, it's extremely hard to see why the login isn't working.
Sometimes if one little thing is modified the wrong way things break.
Also, you could test a new app with the login code and only login routes and one end point to redirect to after login. Get all working and slowly move existing code over a little at a time, (test login each move), then you can tell what broke login.
But I have been using laravel since version 4 and somehow never had this type of login problem.
Please or to participate in this conversation.