/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $AircraftProductions = AircraftProduction::user()->InProduction()->with('aircraft')->get(); foreach ($AircraftProductions as $AircraftProduction) { $AircraftProduction->secLeft = Carbon::now()->diffInSeconds(Carbon::createFromFormat('Y-m-d G:i:s', $AircraftProduction->end)); } $aircraftUsages = AircraftUsage::user()->with('aircraft')->get(); return view('template.fleetOverview', ['AircraftProductions' => $AircraftProductions, 'aircraftUsages' => $aircraftUsages]); }
public static function getAircraftUsageList() { $aircraft_usages = AircraftUsage::user()->with('Aircraft')->get(); //get list for Dropdown foreach ($aircraft_usages as $aircraft_usage) { $aircrafts[$aircraft_usage->id] = $aircraft_usage->aircraft->type; } return $aircrafts; }
/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create($slug = Null) { $stations = Station::user()->with('Airport')->get(); $aircraft_usages = AircraftUsage::user()->with('Aircraft')->get(); $departure_offset = ['+1' => '+1', '+2' => '+2', '0' => '0', '-1' => '-1', '-2' => '-2']; //get list for Dropdown foreach ($aircraft_usages as $aircraft_usage) { $aircrafts[$aircraft_usage->id] = $aircraft_usage->aircraft->type; } //get list for Dropdown foreach ($stations as $station) { $airports[$station->id] = $station->airport->name; } return view('template.flightThread.create', ['stations' => $airports, 'aircrafts' => $aircrafts, 'departure_offset' => $departure_offset]); }