Skip to content

Commit 06ca754

Browse files
authored
fix: send approved email to volunteer (#399)
1 parent 2474362 commit 06ca754

File tree

2 files changed

+6
-22
lines changed

2 files changed

+6
-22
lines changed

app/Http/Controllers/Dashboard/VolunteerController.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use App\Models\VolunteerRequest;
1111
use App\Notifications\UserWasApprovedForVolunteering;
1212
use Illuminate\Http\Request;
13+
use Illuminate\Support\Facades\Notification;
1314
use Inertia\Inertia;
1415
use Spatie\QueryBuilder\QueryBuilder;
1516

@@ -41,8 +42,11 @@ public function index(Request $request, string $status = '')
4142
public function approve(Request $request, VolunteerRequest $volunteerRequest)
4243
{
4344
$this->authorize('update', $volunteerRequest);
45+
4446
$volunteerRequest->markAsApproved();
45-
\Notification::send($volunteerRequest->volunteer->user, new UserWasApprovedForVolunteering());
47+
48+
Notification::route('mail', $volunteerRequest->volunteer->email)
49+
->notify(new UserWasApprovedForVolunteering);
4650

4751
return redirect()->back()
4852
->with('success', __('volunteer.messages.approved'));

app/Notifications/UserWasApprovedForVolunteering.php

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,6 @@ class UserWasApprovedForVolunteering extends Notification implements ShouldQueue
1313
{
1414
use Queueable;
1515

16-
/**
17-
* Create a new notification instance.
18-
*/
19-
public function __construct()
20-
{
21-
//
22-
}
23-
2416
/**
2517
* Get the notification's delivery channels.
2618
*
@@ -40,19 +32,7 @@ public function toMail(object $notifiable): MailMessage
4032
->greeting('Salut,')
4133
->subject('Cererea ta de voluntariat a fost acceptată')
4234
->line('Organizația a acceptat cererea ta de voluntariat. Vei fi contactat de organizație pentru a discuta între voi detaliile. ')
43-
->line('Îţi mulțumim,')
35+
->line(' mulțumim pentru implicare!')
4436
->salutation('Echipa Bursa Binelui');
4537
}
46-
47-
/**
48-
* Get the array representation of the notification.
49-
*
50-
* @return array<string, mixed>
51-
*/
52-
public function toArray(object $notifiable): array
53-
{
54-
return [
55-
//
56-
];
57-
}
5838
}

0 commit comments

Comments
 (0)