public function run()
 {
     Pet::create(array('id' => 3, 'name' => 'Cat 3', 'status' => 'pending', 'category_id' => 2));
     $pet = Pet::find(3);
     $pet->tags()->attach(1);
     $pet->tags()->attach(4);
     Pet::create(array('id' => 4, 'name' => 'Dog 1', 'status' => 'available', 'category_id' => 1));
     $pet = Pet::find(4);
     $pet->tags()->attach(2);
     $pet->tags()->attach(3);
     Pet::create(array('id' => 5, 'name' => 'Dog 2', 'status' => 'sold', 'category_id' => 1));
     $pet = Pet::find(5);
     $pet->tags()->attach(1);
     $pet->tags()->attach(2);
     $pet->tags()->attach(3);
     $pet->tags()->attach(4);
     Pet::create(array('id' => 6, 'name' => 'Dog 3', 'status' => 'pending', 'category_id' => 1));
     $pet = Pet::find(6);
     $pet->tags()->attach(3);
     $pet->tags()->attach(4);
     Pet::create(array('id' => 7, 'name' => 'Lion 1', 'status' => 'available', 'category_id' => 4));
     $pet = Pet::find(7);
     $pet->tags()->attach(1);
     Pet::create(array('id' => 8, 'name' => 'Lion 2', 'status' => 'available', 'category_id' => 4));
     Pet::create(array('id' => 3111, 'name' => 'Cat 4', 'status' => 'pending', 'category_id' => 2));
 }
 /**
  * @SWG\Api(
  *   path="/petdemo/findByTags",
  *   @SWG\Operation(
  *     method="GET",
  *     summary="Finds Pets by tags",
  *     notes="Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3, tag4 for testing.",
  *     type="array",
  *     @SWG\Items("Pet"),
  *     nickname="findPetsByTags",
  *     @SWG\Parameter(
  *       name="tags",
  *       description="Tags to filter by",
  *       required=true,
  *       type="string",
  *       paramType="query"
  *     ),
  *     @SWG\ResponseMessage(code=400, message="Invalid tag value"),
  *     deprecated="true"
  *   )
  * )
  */
 function findByTags()
 {
     $tagsInput = Input::get('tags');
     $tags = explode(",", $tagsInput);
     $tags = array_map('trim', $tags);
     if (empty($tags)) {
         return Response::json(array('code' => 400, 'message' => 'Invalid status value'), 400);
     }
     $pets = Pet::with('category', 'tags')->whereHas('tags', function ($q) use($tags) {
         $q->whereIn('laravel_swagger_tags.name', $tags);
     })->get();
     return Response::json($pets, 200);
 }