private function checkProductHasNoValidShippingPlanForAddress($product) { if (!$this->address) { return true; } $this->address->setFeeType($this->seller); $shippingPlans = $this->shippingPlanRepository->findWhereProduct($product); foreach ($shippingPlans as $shippingPlan) { foreach ($shippingPlan->shippingOptions as $option) { if (isset($option->{$this->address->getFeeType()}) and $option->{$this->address->getFeeType()}) { return false; } } } return true; }
/** * @param Product $product * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function index(Product $product) { $shippingPlans = $this->shippingPlanRepository->whereSeller($this->account())->findAll(); $assignedPlan = $this->shippingPlanRepository->findWhereProduct($product)->first(); return $this->view('shipping::{account}.product.shipping', compact('product', 'shippingPlans', 'assignedPlan')); }