company = $company; $this->setMailConfigs(); } /** * Get the notification's delivery channels. *t('mail::layout') * @param mixed $notifiable * @return array */ public function via($notifiable) { $via = ['database']; if ($notifiable->email_notifications) { array_push($via, 'mail'); } return $via; } /** * Get the mail representation of the notification. * * @param mixed $notifiable * @return \Illuminate\Notifications\Messages\MailMessage */ public function toMail($notifiable) { return (new MailMessage) ->subject(__('email.newCompany.subject').' '.config('app.name').'!') ->greeting(__('email.hello').' '.ucwords($notifiable->name).'!') ->line(__('email.newCompany.text')) ->line('With name:- '.$this->company->company_name) ->action(__('email.loginDashboard'), getDomainSpecificUrl(url('/login'))) ->line(__('email.thankyouNote')); } /** * Get the array representation of the notification. * * @param mixed $notifiable * @return array */ public function toArray($notifiable) { return array_merge($notifiable->toArray(), ['company_name' => $this->company->company_name]); } /** * Get the Slack representation of the notification. * * @param mixed $notifiable * @return SlackMessage */ public function toSlack($notifiable) { $slack = SlackSetting::first(); if(count($notifiable->employee) > 0 && !is_null($notifiable->employee[0]->slack_username)){ return (new SlackMessage()) ->from(config('app.name')) ->image($slack->slack_logo_url) ->to('@' . $notifiable->employee[0]->slack_username) ->content('Welcome to ' . config('app.name') . '! New company has been registered.'); } return (new SlackMessage()) ->from(config('app.name')) ->image($slack->slack_logo_url) ->content('This is a redirected notification. Add slack username for *'.ucwords($notifiable->name).'*'); } }