$data */ public function send( NotificationTypeEnum $type, NotificationSeverityEnum $severity, string $title, string $message, ?Model $notifiable = null, array $data = [], ): Notification { return Notification::create([ 'type' => $type, 'severity' => $severity, 'title' => $title, 'message' => $message, 'data' => $data ?: null, 'notifiable_type' => $notifiable?->getMorphClass(), 'notifiable_id' => $notifiable?->getKey(), ]); } /** * @param array $data */ public function info( string $title, string $message, ?Model $notifiable = null, array $data = [], ): Notification { return $this->send(NotificationTypeEnum::GENERAL, NotificationSeverityEnum::INFO, $title, $message, $notifiable, $data); } /** * @param array $data */ public function warning( string $title, string $message, ?Model $notifiable = null, array $data = [], ): Notification { return $this->send(NotificationTypeEnum::GENERAL, NotificationSeverityEnum::WARNING, $title, $message, $notifiable, $data); } /** * @param array $data */ public function error( string $title, string $message, ?Model $notifiable = null, array $data = [], ): Notification { return $this->send(NotificationTypeEnum::GENERAL, NotificationSeverityEnum::ERROR, $title, $message, $notifiable, $data); } }