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]);
 }
 /**
  * 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);*/
 }
Beispiel #3
0
 /**
  * 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');
 }
 /**
  * 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);
 }