user = $user; $this->student = $student; $this->data = $data; } /** * Get the notification's delivery channels. * * @return array */ public function via(object $notifiable): array { if($this->data['only_db_notification']){ return ['database']; } return ['database', MimSmsChannel::class, 'mail']; } /** * Get the mail representation of the notification. */ public function toMail(object $notifiable) { return (new RegistrationMail($this->user, $this->student, $this->data))->to($this->user->email); } public function toDatabase($notifiable) { return [ 'title' => 'Account Created', 'message' => 'Your account is successfully created.', 'business_id' => $this->student->business_id, 'business_name' => $this->user->business->business_name, 'student_id' => $this->student->id, 'student_name' => $this->user->first_name . ($this->user->middle_name ?? null) . ($this->user->last_name ?? null), 'username' => $this->user->username, 'user_id' => $this->user->id, 'url' => route('students.details', $this->student->id), 'notified_at' => now(), ]; } public function toMimSms($notifiable) { $message = view('notifications.sms.students.registration', [ 'user' => $this->user, 'student' => $this->student, 'data' => $this->data, ])->render(); return [ 'business_id' => $this->user->business_id, 'phone' => $this->user->mobile, 'message' => $message, ]; } /** * Get the array representation of the notification. * * @return array */ public function toArray(object $notifiable): array { return [ // ]; } }