コード例 #1
0
 public function addRestaurant(Request $request, $orgId, $id)
 {
     $organization = Organization::find($orgId);
     $restaurant = Restaurant::find($id);
     $organization->restaurants()->save($restaurant);
     return redirect()->route('restaurant.index', ['orgId' => $orgId]);
 }
コード例 #2
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $restaurant = Restaurant::find($id);
     if (!$restaurant) {
         return $this->respondNotFound('Restaurant does not exist.');
         /*return Response::json([
               'error' => [
                   'message'       => 'Restaurant does not exist.',
                   'status_code'   => 404
               ]
           ], 404);*/
     }
     return $this->respond(['data' => $this->fractal->item($restaurant, new RestaurantTransformer())]);
     /*return Response::json([
     
                 'data' => $this->restaurantTransformer->transform($restaurant)
             ], 200);*/
 }
コード例 #3
0
ファイル: Restaurants.php プロジェクト: NgoDucHai/AngularJs01
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy(Request $request)
 {
     $restaurant = Restaurant::find($request->input('id_restaurant'));
     $restaurant->delete();
     return "Restaurant record successfully deleted #" . $request->input('id');
 }
コード例 #4
0
 /**
  * Display the specified resource.
  *
  * @param  int $id
  *
  * @return Response
  */
 public function show($id)
 {
     $restaurant = Restaurant::find($id);
     $restaurant->price = $this->getPriceById($restaurant->price_id)->interval;
     return response()->json(["msg" => "Success", "restaurant" => $restaurant->toArray()], 200);
 }