Skip to content

Commit

Permalink
fix: send approved email to volunteer (#399)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreiio authored Feb 13, 2025
1 parent 2474362 commit 06ca754
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 22 deletions.
6 changes: 5 additions & 1 deletion app/Http/Controllers/Dashboard/VolunteerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use App\Models\VolunteerRequest;
use App\Notifications\UserWasApprovedForVolunteering;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Notification;
use Inertia\Inertia;
use Spatie\QueryBuilder\QueryBuilder;

Expand Down Expand Up @@ -41,8 +42,11 @@ public function index(Request $request, string $status = '')
public function approve(Request $request, VolunteerRequest $volunteerRequest)
{
$this->authorize('update', $volunteerRequest);

$volunteerRequest->markAsApproved();
\Notification::send($volunteerRequest->volunteer->user, new UserWasApprovedForVolunteering());

Notification::route('mail', $volunteerRequest->volunteer->email)
->notify(new UserWasApprovedForVolunteering);

return redirect()->back()
->with('success', __('volunteer.messages.approved'));
Expand Down
22 changes: 1 addition & 21 deletions app/Notifications/UserWasApprovedForVolunteering.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@ class UserWasApprovedForVolunteering extends Notification implements ShouldQueue
{
use Queueable;

/**
* Create a new notification instance.
*/
public function __construct()
{
//
}

/**
* Get the notification's delivery channels.
*
Expand All @@ -40,19 +32,7 @@ public function toMail(object $notifiable): MailMessage
->greeting('Salut,')
->subject('Cererea ta de voluntariat a fost acceptată')
->line('Organizația a acceptat cererea ta de voluntariat. Vei fi contactat de organizație pentru a discuta între voi detaliile. ')
->line('Îţi mulțumim,')
->line(' mulțumim pentru implicare!')
->salutation('Echipa Bursa Binelui');
}

/**
* Get the array representation of the notification.
*
* @return array<string, mixed>
*/
public function toArray(object $notifiable): array
{
return [
//
];
}
}

0 comments on commit 06ca754

Please sign in to comment.