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 = OrderPackageExpressBillPrintRecords::query()->where('logistic_number',$logisticNumber)->max("print_count"); if ($printCount == 0) $printCount = 1; else $printCount ++; $data['print_count'] = $printCount; $data['process_id'] = Auth::user()['id']; OrderPackageExpressBillPrintRecords::query()->create($data); return ['success' => true]; } }