* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0 */ namespace App\Notifications; use App\Models\User; use Illuminate\Bus\Queueable; use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Notification; class UserWarning extends Notification { use Queueable; /** * Create a new notification instance. */ public function __construct(public User $user) { } /** * Get the notification's delivery channels. * * @return array */ public function via(object $notifiable): array { return ['database', 'mail']; } /** * Get the mail representation of the notification. */ public function toMail(object $notifiable): MailMessage { return (new MailMessage()) ->greeting('Hit and Run Warning Received!') ->line('You have received an automated hit and run WARNING on one or more torrents!') ->action('View your unsatisfied torrents and seed off your warnings or wait until they expire!', route('users.history.index', ['user' => $this->user])) ->line('Thank you for using 🚀'.config('other.title')); } /** * Get the array representation of the notification. * * @return array */ public function toArray(object $notifiable): array { return [ 'title' => 'Hit and Run Warning Received!', 'body' => 'You have received an automated hit and run WARNING on one or more torrents! View your unsatisfied torrents and seed off your warnings or wait until they expire!', 'url' => route('users.history.index', ['user' => $this->user]), ]; } }