コード例 #1
0
 /**
  * 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();
     }
 }
コード例 #2
0
 public static function GenerateFake($faker)
 {
     return ['pack_id' => $faker->numberBetween($min = 1, $max = Pack::count()), 'product_id' => $faker->numberBetween($min = 1, $max = Product::count())];
 }
コード例 #3
0
ファイル: PackCest.php プロジェクト: soutoner/api-desconecta
 public function priceMustBeUnique(FunctionalTester $I)
 {
     $this->model->price = Pack::findFirst()->price;
     $I->assertFalse($this->model->save());
 }