public function getMovies(Request $request) { date_default_timezone_set('Europe/Moscow'); if ($request->input('city_id') == null) { $city = $request->user()->city_id; } else { $city = $request->input('city_id'); } $cities = Cities::orderBy('city')->get(); $cityList = []; foreach ($cities as $key => $value) { $cityList[$value->id] = $value->city; } $cinemas = Cinemas::where("city_id", $city)->orderBy("title")->get(); $cinemasIds = array_pluck($cinemas, "id"); $seances = \App\Seances::whereIn("cinema_id", $cinemasIds)->where("start_time", '>', date("Y-m-d H:i:s"))->groupBy("movie_id")->with('getMovie')->get(); $movies = []; foreach ($seances as $item) { $movie = $item->getMovie->getAttributes(); $poster = json_decode($item->getMovie->poster)->name; $movie['poster'] = $poster; //Helper::getPosterLink($poster); $movies[] = $movie; } return view()->make('search.movies_filter', array('movies' => $movies, 'cityList' => $cityList, 'city' => $city)); }
public function editProfile(Request $request) { $user = User::find($request->user()->id); $cities = Cities::orderBy('city')->get(); $cityList = []; foreach ($cities as $key => $value) { $cityList[$value->id] = $value->city; } return view()->make('user.edit', array('user' => $user, 'cityList' => $cityList)); }