Exemplo n.º 1
0
 public function district(Request $request)
 {
     $district_id = $request->input('district');
     $districts = District::where('id', '=', $district_id)->get();
     $sectors = Sector::where('district_id', "=", $district_id)->get();
     foreach ($sectors as $sector) {
         $sectors_ids[] = $sector->id;
     }
     $cells = Cell::whereIn('sector_id', $sectors_ids)->get();
     foreach ($cells as $cell) {
         $cells_ids[] = $cell->id;
     }
     $markets = Market::whereIn('cell_id', $cells_ids)->get();
     foreach ($markets as $market) {
         $markets_ids[] = $market->id;
     }
     $prices = Price::whereIn('market_id', $markets_ids)->get();
     return view('reports.district')->with('districts', $districts)->with('sectors', $sectors)->with('prices', $prices);
 }
Exemplo n.º 2
0
|         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']);