Файловый менеджер - Редактировать - /home/clickysoft/public_html/assets.clickysoft.net/app/Console/Commands/NotifyScheduledMaintenance.php
Назад
<?php namespace App\Console\Commands; use Illuminate\Console\Command; use App\Models\MaintenanceSchedule; use App\Notifications\MaintenanceReminderNotification; use Illuminate\Support\Facades\Notification; use Carbon\Carbon; class NotifyScheduledMaintenance extends Command { protected $signature = 'maintenance:notify'; protected $description = 'Notify users of assets scheduled for maintenance today'; public function handle() { // Get current date $today = Carbon::today(); // Fetch maintenance tasks scheduled for today $scheduledMaintenances = MaintenanceSchedule::where('scheduled_date', $today) ->where('status', '1') ->with(['asset', 'user']) ->get(); foreach ($scheduledMaintenances as $maintenance) { $user = $maintenance->user; if ($user) { Notification::send($user, new MaintenanceReminderNotification($maintenance)); } } // Log output (optional) $this->info('Maintenance notifications sent successfully.'); } }
| ver. 1.4 |
Github
|
.
| PHP 8.1.29 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка