function index() { $facilities = [0 => '- All -', 1 => 'Flight Service Station', 2 => 'Clearance Delivery', 3 => 'Ground', 4 => 'Tower', 5 => 'Approach/Departure', 6 => 'Center']; $atc = ATC::with('pilot', 'airport', 'airport.country', 'sector')->orderBy('callsign')->whereNull('end')->whereNotIn('facility_id', array(0, 99)); if (Input::has('facility') && array_key_exists(Input::get('facility'), $facilities) && Input::get('facility') != 0) { $atc = $atc->whereFacilityId(Input::get('facility')); } $atc = $atc->paginate(25); // $countries = ATC::with('airport','airport.country')->whereNull('end')->whereNotIn('facility_id', array(0, 99))->whereNotNull('airport_id')->get(); // $countries = $countries->transform(function($value) { // return $value->airport->country; // })->sortBy('country')->lists('country','id'); // array_unshift($countries, '- All -'); $this->autoRender(compact('atc', 'countries', 'facilities'), 'ATC'); }
function show(Pilot $pilot) { $actives = ATC::with('airport', 'airport.country')->whereVatsimId($pilot->vatsim_id)->whereNull('end')->where('facility_id', '!=', 99)->get(); $duties = ATC::with('airport', 'airport.country')->whereVatsimId($pilot->vatsim_id)->whereNotNull('end')->where('facility_id', '!=', 99)->orderBy('end', 'desc')->take(15)->get(); if ($pilot->processing == 0) { Queue::push('LegacyUpdate', $pilot->vatsim_id, 'legacy'); $pilot->processing = 2; $pilot->save(); } if ($pilot->processing == 2) { Messages::success('The data for this controller is currently being processed. In a couple of minutes, all statistics will be available.')->one(); } $stat = new ControllerStat(ATC::whereVatsimId($pilot->vatsim_id)->where('facility_id', '!=', 99)); extract($stat->durations($pilot->duration_atc)); $airports = $stat->topAirports(); $facilities = $stat->topFacilities(); $this->javascript('assets/javascript/jquery.flot.min.js'); $this->javascript('assets/javascript/jquery.flot.pie.min.js'); $this->autoRender(compact('pilot', 'duties', 'actives', 'airport', 'airports', 'longest', 'hours', 'minutes', 'facilities'), $pilot->name); }
| */ Route::bind('flight', function ($value) { $flight = Flight::with(['aircraft', 'departure', 'arrival', 'pilot', 'departureCountry', 'arrivalCountry', 'airline', 'positions' => function ($positions) { $positions->join('updates', 'positions.update_id', '=', 'updates.id'); $positions->select('positions.*', DB::raw('updates.timestamp AS time')); $positions->orderBy('time', 'asc'); }])->find($value); if (is_null($flight) || $value == 0) { return App::abort(404); } else { return $flight; } }); Route::bind('atc', function ($value) { $atc = ATC::with('pilot')->find($value); if (is_null($atc) || $value == 0) { return App::abort(404); } else { return $atc; } }); Route::bind('pilot', function ($value) { $pilot = Pilot::whereVatsimId($value)->first(); if (is_null($pilot) || $value == 0) { return App::abort(404); } else { return $pilot; } }); Route::bind('airport', function ($value, $route) {