/** * Deletes a pack from the database. * * @param $id - Id of the pack to be deleted * @return Response * @throws ResourceNotFoundException */ public function delete($id) { $id = $this->filter->sanitize($id, 'int'); try { $pack = Pack::findFirstOrFail(['id = ?0', 'bind' => [$id]]); return $this->response($this->request, $pack); } catch (ResourceNotFoundException $e) { return $e->returnResponse(); } }
public static function GenerateFake($faker) { return ['pack_id' => $faker->numberBetween($min = 1, $max = Pack::count()), 'product_id' => $faker->numberBetween($min = 1, $max = Product::count())]; }
public function priceMustBeUnique(FunctionalTester $I) { $this->model->price = Pack::findFirst()->price; $I->assertFalse($this->model->save()); }