with('order')->where('logistic_number',$logisticNumber)->first(); $data = ['logistic_number' => $logisticNumber]; if ($orderPackage){ $data['order_id'] = $orderPackage['order']['id']; $data['order_package_id'] = $orderPackage['id']; } $printCount = OrderPackageExpressBillPrintRecord::query()->where('logistic_number',$logisticNumber)->max("print_count"); if ($printCount == 0) $printCount = 1; else $printCount ++; $data['print_count'] = $printCount; $data['task_id'] = $task_id; $data['process_id'] = Auth::user()['id']; OrderPackageExpressBillPrintRecord::query()->create($data); return ['success' => true]; } }