Created
October 19, 2023 12:14
-
-
Save neverything/13438d11f5231cd29b184b6d6aa6fdef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Notifications; | |
use Illuminate\Notifications\Messages\MailMessage; | |
use Illuminate\Notifications\Notification; | |
class MagicLoginLink extends Notification | |
{ | |
/** | |
* Create a new notification instance. | |
*/ | |
public function __construct( | |
public string $url | |
) | |
{ | |
// | |
} | |
/** | |
* Get the notification's delivery channels. | |
* | |
* @return array<int, string> | |
*/ | |
public function via(object $notifiable): array | |
{ | |
return ['mail']; | |
} | |
/** | |
* Get the mail representation of the notification. | |
*/ | |
public function toMail(object $notifiable): MailMessage | |
{ | |
return (new MailMessage) | |
->subject('Your Login Link to '.config('app.name')) | |
->line('Click the link below to login to your account.') | |
->action('Login Now', $this->url) | |
->line('Thank you for using our application.'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment