public function getExplore() { $loggedIn = $this->loggedIn; $title = 'index'; $markets = $this->markets; $subscriptions = Subscriber::where('user_id', Auth::user()->id)->get(); foreach ($subscriptions as $subscription) { $userSubscriptions[$subscription->market_id] = Market::where('id', $subscription->market_id)->first(); } foreach ($markets as $market) { $items[$market->id] = $market->items()->orderBy('views', 'desc')->take(2)->get(); } foreach ($items as $itemsSet) { foreach ($itemsSet as $item) { $users[$item->id] = $item->user; } } return view('environment.explore', compact('title', 'items', 'markets', 'users', 'loggedIn', 'userSubscriptions')); }
$district = District::where('province_id', '=', $prov_id)->get(); return Response::json($district); }); Route::get('getSector', function () { $distr_id = Input::get('distr_id'); $sector = Sector::where('district_id', '=', $distr_id)->get(); return Response::json($sector); }); Route::get('getCell', function () { $sect_id = Input::get('sect_id'); $cell = Cell::where('sector_id', '=', $sect_id)->get(); return Response::json($cell); }); Route::get('getMarket', function () { $cell_id = Input::get('cell_id'); $mark = Market::where('cell_id', '=', $cell_id)->get(); return Response::json($mark); }); Route::get('index', ['uses' => 'UserController@index', 'as' => 'index']); Route::post('signup', ['uses' => 'UserController@signUp', 'as' => 'signup', 'middleware' => ['guest']]); Route::get('signup', ['as' => 'signup', 'uses' => 'UserController@index']); Route::post('signin', ['uses' => 'UserController@signIn', 'as' => 'signin', 'middleware' => ['guest']]); Route::get('signin', ['as' => 'signin', 'uses' => 'UserController@getSignIn']); Route::get('signout', ['uses' => 'UserController@signOut', 'as' => 'signout']); Route::post('save', ['uses' => 'UserController@savePrice', 'as' => 'save']); Route::get('price', ['uses' => 'UserController@priceRegistration', 'as' => 'price']); Route::get('authe', ['uses' => 'UserController@authenticated', 'as' => 'authe']); Route::get('profile', ['uses' => 'UserController@profile', 'as' => 'profile']); Route::get('contact', ['uses' => 'UserController@contact', 'as' => 'contact']); /* |--------------------------------------------------------------------------