The core functionality of this package is implemented in action classes. You can override the default behaviour by creating your own action classes and registering them in the config/passkeys.php
config file.
Here's an example where we override the StorePasskey
action to add custom logic after a passkey is stored:
First, let's create the custom class.
namespace App\Actions;
use Spatie\LaravelPasskeys\Actions\StorePasskeyAction
class CustomStorePasskeyAction extends StorePasskeyAction
{
public function handle($user, $passkey)
{
parent::handle($user, $passkey);
}
}
Next, register the custom action in the config/passkeys.php
config file:
return [
'actions' => [
'store_passkey' => App\Actions\CustomStorePasskeyAction::class,
],
];