Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

themsaid/ergodnc

262 stars
1 code files
View themsaid/ergodnc on GitHub

app/Console/Commands/SendDueReservationsNotifications.php

Open in GitHub
use App\Models\Reservation;
use App\Notifications\HostReservationStarting;
use App\Notifications\UserReservationStarting;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Notification;
 
class SendDueReservationsNotifications extends Command
{
protected $signature = 'ergodnc:send-reservations-notifications';
 
protected $description = 'Command description';
 
public function __construct()
{
parent::__construct();
}
 
public function handle()
{
Reservation::query()
->with('office.user')
->where('status', Reservation::STATUS_ACTIVE)
->where('start_date', now()->toDateString())
->each(function ($reservation) {
Notification::send($reservation->user, new UserReservationStarting($reservation));
Notification::send($reservation->office->user, new HostReservationStarting($reservation));
});
 
return 0;
}
}

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.