public function look(Request $request) { $sector_id = $request->input('category'); $cells = Cell::where('sector_id', "=", $sector_id)->get(); foreach ($cells as $cell) { $cell_ids[] = $cell->id; } $markets = Market::whereIn('cell_id', $cell_ids)->get(); foreach ($markets as $market) { $markets_ids[] = $market->id; } $prices = Price::whereIn('market_id', $markets_ids)->get(); $sectors = Sector::where('id', '=', $sector_id)->get(); return view('reports.sector')->with('cells', $cells)->with('markets', $markets)->with('prices', $prices)->with('sectors', $sectors); }
| here is where all user's route located | */ Route::get('getDistrict', function () { $prov_id = Input::get('prov_id'); $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']);