예제 #1
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     //
     $age = Age::find($id);
     //return $gender;
     if (count($age) > 0) {
         $statusCode = 200;
         $response = ['id' => $age->id, 'Age' => $age->age];
     } else {
         $response = ["error" => "Age doesn`t exist"];
         $statusCode = 404;
     }
     return response($response, $statusCode)->header('Content-Type', 'application/json');
 }