コード例 #1
0
 /**
  * Display the specified resource.
  * GET /vehicle/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function show(VehicleTransformer $transformer, $id)
 {
     try {
         $vehicle = Vehicle::findOrFail($id);
     } catch (ModelNotFoundException $e) {
         return $this->respondNotFound('Vehicle does not exist');
     }
     return $this->respondOk(['vehicle' => $transformer->transform($vehicle)]);
 }
コード例 #2
0
 /**
  * Gets a vehicle by id
  *
  * @param $id
  * @throws ModelNotFoundException
  * @return Vehicle
  */
 public function get($id)
 {
     return Vehicle::findOrFail($id);
 }