I used the following code; <?php
namespace App\Http\Controllers;
use App\Models\User; use Illuminate\Http\Request; use Illuminate\Support\Facades\Hash; use Laravel\Fortify\Fortify;
class LoginController extends Controller { public function authenticate(Request $request) {
Fortify::authenticateUsing(function (Request $request) { $user = User::where('email', $request->email)->first(); if ($user && Hash::check($request->password, $user->password)) { print_r($user); return $user; } }); }
} But it doesn't work. Where am I going wrong?
Are you routing the controller correctly? If there is an error what is the error?
Well. It's good you trying it on newer version. unfortunatly i havent tried yet. I hope someone will definitly answer this.
Maybe your login form action is not making a request to your LoginController?
Route::post('authenticate', [LoginController::class, 'authenticate'])->name('authenticate');
<form method="POST" action="{{ route('authenticate') }}">
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I used the following code;
<?php
namespace App\Http\Controllers;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Laravel\Fortify\Fortify;
class LoginController extends Controller
{
public function authenticate(Request $request)
{
}
But it doesn't work. Where am I going wrong?
Are you routing the controller correctly?
If there is an error what is the error?
Well. It's good you trying it on newer version. unfortunatly i havent tried yet. I hope someone will definitly answer this.
Maybe your login form action is not making a request to your LoginController?