How to check additional field during login in Laravel?
Now it works from the box and accepts email and password. How to check additionally status parameter when user log in?
I use this LoginController
:
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
class LoginController extends Controller
{
use AuthenticatesUsers;
}
I tried this in LoginController:
public function authenticate(Request $request)
{
$credentials = $request->only('email', 'password');
$credentials['status'] = 1;
if (Auth::attempt($credentials)) {
return redirect()->intended('home');
}
}
But Laravel ignores this method authenticate().
if to remove use AuthenticatesUsers;
it becomes alive, but then does not work logout, login page.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire