Spatie Activity Log with Fortify

· · 9927 views

Hi. I am using fortify for auth. I need to log user auth events. I've created a loginlistener file.

    public function handle(Login $event): void
    {
        activity()->log('Logged in');
        notyf()->addSuccess('Merhaba ' . $event->user->name);
    }

and added into eventserviceprovider file like this.

use Illuminate\Auth\Events\Login;
class EventServiceProvider extends ServiceProvider
{
    protected $listen = [
        Registered::class => [
            SendEmailVerificationNotification::class,
        ],
        Login::class => ['App\Listeners\LoginSuccesful'],
    ];
	...
}

But it doesnt work. How can I log fortify auth events.

0
1 Answer

I've added Spatie activity model. It works now.

use Spatie\Activitylog\Models\Activity;

0

Please login or create new account to participate in this conversation.