/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index($id = null) { if ($id == null) { return Restaurant::orderBy('id_restaurant', 'asc')->get(); } else { return $this->show($id); } }
/** * Display a listing of the resource. * * @return Response */ public function index(Request $request, $orgId) { $organization = \App\Organization::findOrFail($orgId); $restaurants = Restaurant::orderBy('name')->get(); foreach ($restaurants as $restaurant) { $restaurant->is_used = false; if (count($organization->restaurants) > 0) { foreach ($organization->restaurants as $orgRest) { if ($orgRest->id == $restaurant->id) { $restaurant->is_used = true; } } } } return view('restaurants.list', ['restaurants' => $restaurants, 'organization' => $organization]); }
/** * Get last 6 restaurants added * * @return Response */ public function getLastEntries() { $restaurants = Restaurant::orderBy('id', 'desc')->take(6)->get(); return response()->json(["msg" => "Success", "restaurants" => $restaurants->toArray()], 200); }
public function create(Request $request) { $restaurants = Restaurant::orderBy('name')->get(); return view('userOrders.form', ['restaurants' => $restaurants, 'user_order' => new \App\UserOrder()]); }
public function addRestaurant($id) { $poll = \App\Poll::findOrFail($id); return view('polls.restaurant', ['poll' => $poll, 'restaurants' => Restaurant::orderBy('name')->get()]); }