public function update(Request $request, ShippingPlan $shippingPlan)
 {
     if ($products = $request->input('products') ?: []) {
         // instead of authorizing each product against seller
         // simply filter out invalid and unauthorized products
         // only sync the valid product ids
         $products = $this->productManager->getProductRepository()->whereIn('id', $products)->whereSeller($this->account())->findAll();
     }
     $shippingPlan->products()->sync($products);
     return $this->success('update');
 }
 public function show(ShippingPlan $shippingPlan)
 {
     $shippingOptions = $shippingPlan->getShippingOptions();
     return view('shipping::plans.show', compact('shippingPlan', 'shippingOptions'));
 }
예제 #3
0
 protected function createShippingOptions($count, ShippingPlan $plan)
 {
     return $plan->shippingOptions()->saveMany(factory(ShippingOption::class, $count)->make());
 }