/**
  * Creates a variant of the specified inventory item.
  *
  * @param InventoryRequest $request
  * @param int|string       $itemId
  *
  * @return bool
  */
 public function store(InventoryRequest $request, $itemId)
 {
     $item = $this->inventory->findOrFail($itemId);
     $variant = $item->newVariant();
     $variant->name = $request->input('name', $item->name);
     $variant->category_id = $request->input('category', $item->category_id);
     $variant->metric_id = $request->input('metric', $item->metric_id);
     return $variant->save();
 }
Пример #2
0
 /**
  * Execute the job.
  *
  * @return bool
  */
 public function handle()
 {
     $this->inventory->category_id = $this->request->input('category', $this->inventory->category_id);
     $this->inventory->metric_id = $this->request->input('metric', $this->inventory->metric_id);
     $this->inventory->name = $this->request->input('name', $this->inventory->name);
     $this->inventory->description = $this->request->clean($this->request->input('description', $this->inventory->description));
     return $this->inventory->save();
 }
Пример #3
0
 /**
  * Execute the job.
  *
  * @return bool
  */
 public function handle()
 {
     $this->inventory->user_id = auth()->id();
     $this->inventory->category_id = $this->request->input('category');
     $this->inventory->metric_id = $this->request->input('metric');
     $this->inventory->name = $this->request->input('name');
     $this->inventory->description = $this->request->clean($this->request->input('description'));
     return $this->inventory->save();
 }