check if the task is future or ongoing to send email and notification on deletion
This commit is contained in:
1 parent
6966027096
commit
77d3efc555
1 file changed
+3
@@ -10,6 +10,7 @@ use App\Mail\VolunteerUnassignToTaskMail;
|
|||||||
use App\Models\Events;
|
use App\Models\Events;
|
||||||
use App\Models\Task;
|
use App\Models\Task;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use Carbon\Carbon;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Gate;
|
use Illuminate\Support\Facades\Gate;
|
||||||
@@ -147,6 +148,7 @@ class TasksController extends Controller
|
|||||||
|
|
||||||
$participants = $task->users;
|
$participants = $task->users;
|
||||||
|
|
||||||
|
if (Carbon::now()->lessThanOrEqualTo($task->end)) {
|
||||||
foreach ($participants as $user) {
|
foreach ($participants as $user) {
|
||||||
broadcast(new TaskParticipationCancelled(
|
broadcast(new TaskParticipationCancelled(
|
||||||
$user->id,
|
$user->id,
|
||||||
@@ -163,6 +165,7 @@ class TasksController extends Controller
|
|||||||
];
|
];
|
||||||
Mail::to($user->email)->send(new TaskParticipationCancelledMail($data));
|
Mail::to($user->email)->send(new TaskParticipationCancelledMail($data));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$task->delete();
|
$task->delete();
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user