-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IP-78: As a platform admin/content manager, when a new solution is su…
…bmitted I receive an email notification with the submission details
- Loading branch information
1 parent
2f3067b
commit 0c77a77
Showing
5 changed files
with
80 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
|
||
namespace App\Notifications; | ||
|
||
use App\Models\Solution\Solution; | ||
use Illuminate\Bus\Queueable; | ||
use Illuminate\Contracts\Queue\ShouldQueue; | ||
use Illuminate\Notifications\Messages\MailMessage; | ||
use Illuminate\Notifications\Notification; | ||
|
||
class SolutionSubmittedForReview extends Notification implements ShouldQueue { | ||
use Queueable; | ||
|
||
protected Solution $solution; | ||
|
||
/** | ||
* Create a new notification instance. | ||
*/ | ||
public function __construct(Solution $solution) { | ||
$this->solution = $solution; | ||
} | ||
|
||
/** | ||
* Get the notification's delivery channels. | ||
* | ||
* @return array<int, string> | ||
*/ | ||
public function via(object $notifiable): array { | ||
return ['mail']; | ||
} | ||
|
||
/** | ||
* Get the mail representation of the notification. | ||
*/ | ||
public function toMail(object $notifiable): MailMessage { | ||
return (new MailMessage) | ||
->subject('Crowdsourcing Platform | ' . __('notifications.solution_submitted') . ': ' . $this->solution->defaultTranslation->title) | ||
->line(__('notifications.new_solution_submitted')) | ||
->line('<div style="text-align:center; height: 200px; margin-bottom: 20px;"><img class="badgeImg" style="height: 200px; margin-bottom: 0;" src=' . asset('images/active_participation.webp') . '></div>') | ||
->greeting(__('notifications.hello') . ' ' . $notifiable->nickname . '!') | ||
->line(__('notifications.a_user_has_proposed_solution')) | ||
->line('Username: ' . $this->solution->creator->nickname) | ||
->line('Email: ' . $this->solution->creator->email) | ||
->line('Campaign: ' . $this->solution->problem->project->defaultTranslation->name) | ||
->line('Problem: ' . $this->solution->problem->defaultTranslation->title) | ||
->line('Solution: ' . $this->solution->defaultTranslation->title) | ||
->line(__('notifications.check_solution_and_review')) | ||
->action(__('notifications.see_submitted_solutions'), route('solutions.index', ['locale' => app()->getLocale()])) | ||
->salutation(__('notifications.thanks_message_2')); | ||
} | ||
|
||
/** | ||
* Get the array representation of the notification. | ||
* | ||
* @return array<string, mixed> | ||
*/ | ||
public function toArray(object $notifiable): array { | ||
return [ | ||
// | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters