Laravel Jetstream Custom Authentication Login Process Pass Request

Viewed 143

I've been reading and following jetstream's documentation and I wanted to create a custom class for the authentication process:

If you prefer to encapsulate your custom authentication process within a class instead of a closure, you may pass a PHP "callable" array to the authenticateUsing method:

use App\Actions\AuthenticateLoginAttempt;
use Laravel\Fortify\Fortify;

Fortify::authenticateUsing([new AuthenticateLoginAttempt, '__invoke']);

I have already created the file AuthenticateLoginAttempt in App/Actions folder:

<?php

namespace App\Actions;

class AuthenticateLoginAttempt
{
    public function __invoke()
    {

    }
}

What I wanted is also to pass the Request $request as an argument that will be used later in the __invoke magic method:

Fortify::authenticateUsing([new AuthenticateLoginAttempt, '__invoke', ...Request $request...]);

public function __invoke(Request $request)
{
    
}

How to achieve this one? It seems to me that their documentation is unclear to me. Thank you.

0 Answers
Related