Файловый менеджер - Редактировать - /home/clickysoft/public_html/jm5-api.clickysoft.net/app/Console/Commands/SendPDOrdersMailCommand.php
Назад
<?php namespace App\Console\Commands; use App\Mail\PDOrdersMail; use App\Models\Order; use Illuminate\Console\Command; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Mail; class SendPDOrdersMailCommand extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'email:send-po-orders-reminder'; /** * The console command description. * * @var string */ protected $description = 'Send email every day to admin.'; public function handle(): void { $old_date = now()->subDays(2)->startOfDay(); $orders = Order::where('created_at', '<=', $old_date)->where('current_status_id', 1)->get(); foreach ($orders as $key => $order) { Mail::to('orders@jmtrophies.com') ->later(now()->addSeconds($key), new PDOrdersMail(['data' => $order->order_number])); } Log::channel('cron_jobs') ->info('PD order cron mail sent at ' . now()->format('m-d-Y h:i:s')); } }
| ver. 1.4 |
Github
|
.
| PHP 8.1.29 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка