Skip to content

Instantly share code, notes, and snippets.

@neverything
Created October 19, 2023 12:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neverything/ba513da4ab18818146598ed6751175e0 to your computer and use it in GitHub Desktop.
Save neverything/ba513da4ab18818146598ed6751175e0 to your computer and use it in GitHub Desktop.
<?php
// On top of the User model add:
use App\Notifications\MagicLoginLink;
use Grosv\LaravelPasswordlessLogin\PasswordlessLogin;
// In the model class, add the following methods:
public function sendMagicLoginLinkNotification(): void
{
$this->notify(new MagicLoginLink($this->getMagicLoginLink()));
}
public function getMagicLoginLink(): string
{
return PasswordlessLogin::forUser($this)->generate();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment