Файловый менеджер - Редактировать - /home/clickysoft/public_html/jm5-api.clickysoft.net/app/Console/Commands/AddOrderItemIdToPOItems.php
Назад
<?php namespace App\Console\Commands; use App\Models\OrderItems; use App\Models\PurchaseOrderToCreate; use Illuminate\Console\Command; use Illuminate\Support\Facades\Log; class AddOrderItemIdToPOItems extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'email:add-item-ids-to-po-orders'; /** * The console command description. * * @var string */ protected $description = 'Add order item id to items that are not created yet.'; public function handle(): void { $order_items = OrderItems::where('po_created', 0)->get(); foreach ($order_items as $item) { $po_items = PurchaseOrderToCreate::where([ 'order_id' => $item->order_id, 'product_id' => $item->product_id, 'price_id' => $item->price_id, 'quantity' => $item->quantity, ])->get(); foreach ($po_items as $po_item) { $po_item->order_item_id = $item->id; $po_item->save(); } } Log::channel('info_errors') ->info("Record ids updated for PO To Create."); } }
| ver. 1.4 |
Github
|
.
| PHP 8.1.29 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка