public function update(Request $request) { $child_quantity = intval($request->child_quantity); if ($child_quantity < 0) { $child_quantity = 0; } Booking::update($request->rowId, ['options' => ['child_quantity' => $child_quantity]]); Booking::update($request->rowId, $request->adult_quantity); return Booking::content(); }
public function test_it_edits_an_item_on_the_booking() { $this->addNewItem(); foreach (Booking::content() as $item) { $updateItem = ['rowId' => $item->rowid, 'qty' => 3, 'options' => ['child_quantity' => 2]]; Booking::update($item->rowid, ['options' => ['child_quantity' => 2]]); Booking::update($item->rowid, 3); $this->assertEquals(2, $item->options->child_quantity); $this->assertEquals(3, $item->qty); } }