public static function checkTrackingNumbers() { $lab_works = LabWork::where('status_id', 1)->get(); foreach ($lab_works as $v) { if ($v->trackingNumbers()->orderBy('id', 'DESC')->count() > 0) { $tracking_number = $v->trackingNumbers()->orderBy('id', 'DESC')->take(1)->first(); if (!$tracking_number->marked_as_delivered) { if ($tracking_number->checkStatus() == 'Delivered') { $tracking_number->markAsDelivered(); $v->updateStatus(2, 0, 'Automatically updated by Shipping API'); } } } } $lab_works = LabWork::where('status_id', 4)->get(); foreach ($lab_works as $v) { $tracking_number = $v->trackingNumbers()->orderBy('id', 'DESC')->take(1)->first(); if (!$tracking_number->marked_as_delivered) { if ($tracking_number->checkStatus() == 'Delivered') { $tracking_number->markAsDelivered(); $v->updateStatus(5, 0, 'Automatically updated by Shipping API'); } } } }
public function showCompleteDocket($lab_work_id, $docket_id) { $lab_work = LabWork::findOrFail($lab_work_id); $docket = Docket::findOrFail($docket_id); if ($lab_work->branch->addresses->count() > 0) { $branch_postcode = $lab_work->branch->addresses()->first()->postcode; } else { $branch_postcode = ''; } $vars = ["lab_work" => $lab_work, "docket" => $docket, "branch_postcode" => $branch_postcode]; return view('backend.page.complete-docket')->with($vars); }
public function doAddUpdateMessage(Request $request) { $lab_work = LabWork::findOrFail($request->input('lab_work_id')); $comment = $lab_work->addComment($request->input('message'), \Auth::user()->id); if ($request->hasFile('attachment')) { $comment->addAttachment($request->file('attachment')); } return back(); }