Skip to content

Commit

Permalink
Merge pull request #1407 from bakaphp/hotfix-email-provider
Browse files Browse the repository at this point in the history
Merge pull request #1358 from bakaphp/development
  • Loading branch information
kaioken committed May 29, 2024
2 parents 20946cc + 7be4cb0 commit f22bec7
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,12 @@ public function sendNotificationBaseOnTemplate(mixed $root, array $request): boo
$userToNotify = UsersRepository::findUsersByArray($request['users'], $company);
}

$data = Str::isJson($request['data']) ? json_decode($request['data'], true) : (array) $request['data']; // This can have more validation like validate if is array o json
$data['app'] = app(Apps::class);

$notification = new Blank(
$request['template_name'],
Str::isJson($request['data']) ? json_decode($request['data'], true) : (array) $request['data'], // This can have more validation like validate if is array o json
$data,
$request['via'],
$user,
key_exists('attachment', $request) ? $request['attachment'] : null
Expand All @@ -52,14 +55,15 @@ public function anonymousNotification(mixed $root, array $request)
{
$data = Str::isJson($request['data']) ? json_decode($request['data'], true) : (array) $request['data'];
$data['app'] = app(Apps::class);
$user = auth()->user();

$notification = new Blank(
$request['template_name'],
$data,
['mail'],
auth()->user()
$user
);
$notification->setFromUser(auth()->user());
$notification->setFromUser($user);
$notification->setSubject($request['subject']);
Notification::route('mail', $request['email'])->notify($notification);

Expand Down

0 comments on commit f22bec7

Please sign in to comment.