diff --git a/app/Notifications/NewUserJoined.php b/app/Notifications/NewUserJoined.php new file mode 100644 index 0000000..18afd6d --- /dev/null +++ b/app/Notifications/NewUserJoined.php @@ -0,0 +1,61 @@ +user = $user; + } + + /** + * Get the notification's delivery channels. + * + * @return array + */ + public function via(object $notifiable): array + { + return ['mail']; + } + + /** + * Get the mail representation of the notification. + */ + public function toMail(object $notifiable): MailMessage + { + return (new MailMessage) + ->line('A new user has joined the website.') + ->line('Name: ' . $this->user->name) + ->line('Email: ' . $this->user->email) + ->line('Phone: ' . $this->user->phone) + ->line('Location: ' . $this->user->location) + ->action('View User', url(route('users.show', $this->user))) + ->line('Thank you for using our application!'); + } + + /** + * Get the array representation of the notification. + * + * @return array + */ + public function toArray(object $notifiable): array + { + return [ + 'name' => $this->user->name, + 'email' => $this->user->email, + ]; + } +} diff --git a/routes/web.php b/routes/web.php index a4642b5..f722977 100644 --- a/routes/web.php +++ b/routes/web.php @@ -36,6 +36,7 @@ Route::get('/payments', VerifyPayments::class)->name('payments.index'); Route::get('/users', ManageUsers::class)->name('users.index'); + Route::get('/users/{user}', [ManageUsers::class, 'show'])->name('users.show'); Route::get('/orders/create/new/', AutoOrderCreate::class)->name('orders.create.new'); Route::get('/payments/{paymentId}', VerifyOrderPayment::class)->name('payments.show');