本文整理汇总了PHP中Flight::with方法的典型用法代码示例。如果您正苦于以下问题:PHP Flight::with方法的具体用法?PHP Flight::with怎么用?PHP Flight::with使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Flight
的用法示例。
在下文中一共展示了Flight::with方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
function show(Pilot $pilot)
{
$active = Flight::with('departure', 'departure.country', 'arrival', 'arrival.country')->whereVatsimId($pilot->vatsim_id)->whereIn('state', array(0, 1, 3, 4))->first();
$flights = Flight::with('departure', 'departure.country', 'arrival', 'arrival.country')->whereVatsimId($pilot->vatsim_id)->whereState(2)->orderBy('arrival_time', 'desc')->take(15)->get();
$flightCount = Flight::whereVatsimId($pilot->vatsim_id)->whereState(2)->count();
$stats = new FlightStat(Flight::whereVatsimId($pilot->vatsim_id));
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 pilot is currently being processed. In a couple of minutes, all statistics will be available.')->one();
}
$distances = $stats->distances($pilot->distance);
$citypair = $stats->citypair();
if ($flights->count() > 0) {
$durations = $stats->durations($pilot->duration);
extract($durations);
}
// Charts: popular airlines, airports and aircraft
$airlines = $stats->topAirlines();
$airports = $stats->topAirports();
$aircraft = $stats->topAircraft();
$this->javascript('assets/javascript/jquery.flot.min.js');
$this->javascript('assets/javascript/jquery.flot.pie.min.js');
$this->autoRender(compact('pilot', 'flights', 'active', 'distances', 'airlines', 'aircraft', 'airports', 'longest', 'shortest', 'citypair', 'hours', 'minutes'), $pilot->name);
}
示例2: index
public function index()
{
$users = Cache::get('vatsim.users');
$year = Cache::get('vatsim.year');
$month = Cache::get('vatsim.month');
$day = Cache::get('vatsim.day');
$change = Cache::get('vatsim.change');
$changeArrow = Cache::get('vatsim.changeDirection');
$distance = Cache::get('vatsim.distance');
$flights = Flight::with('pilot', 'departure', 'arrival')->whereState(1)->whereMissing(0)->orderBy(DB::raw('RAND()'))->take(15)->get();
$this->autoRender(compact('users', 'year', 'month', 'day', 'change', 'changeArrow', 'distance', 'flights'));
}
示例3: index
function index()
{
$flights = Flight::with('departureCountry', 'arrivalCountry', 'departure', 'arrival', 'pilot')->where('departure_time', '!=', '')->whereState(1)->orderBy('departure_time', 'desc')->orderBy('callsign')->paginate(25);
$this->autoRender(compact('flights'), 'Flights');
}
示例4: index
function index()
{
$pilots = Flight::with('pilot')->select(DB::raw('vatsim_id, COUNT(vatsim_id) AS aggregate, SUM(distance) as distance, SUM(duration) as duration'))->orderBy('aggregate', 'desc')->groupBy('vatsim_id')->paginate(50);
$this->autoRender(compact('pilots'), 'Pilots');
}
示例5: function
});
Route::get('search', ['as' => 'search', 'uses' => 'SearchController@index']);
Route::get('citypair/{departure}-{arrival}', ['as' => 'citypair', 'uses' => 'FlightController@citypair'])->where('departure', '[A-Z0-9]{3,4}')->where('arrival', '[A-Z0-9]{3,4}');
/*
|--------------------------------------------------------------------------
| Bindings
|--------------------------------------------------------------------------
|
| Bindings replace the variables in the URL with their respective classes
| that are passed as a parameter to the controller methods.
|
*/
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;
}