本文整理汇总了PHP中Flight::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Flight::save方法的具体用法?PHP Flight::save怎么用?PHP Flight::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Flight
的用法示例。
在下文中一共展示了Flight::save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveFlights
/**
* @param $configdepart
* @return bool
*/
private function saveFlights(Configdepart $configdepart)
{
// Combien de flights à créer
$nbFlights = ceil($configdepart->nbjoueurs / $configdepart->slotbyflight) + $configdepart->startergap;
// Met a jour Configdepart->slotcount : nombre de places disponibes créees
$configdepart->slotcount = $nbFlights * $configdepart->slotbyflight;
$configdepart->save();
// Supprimer les Flight de cette config
$configdepart->flights()->delete();
// Boucle tous les flight à créer
for ($i = 1; $i <= $nbFlights; $i++) {
$addMinutes = ($i - 1) * $configdepart->interval;
$newheure = Carbon::createFromFormat('H:i', $configdepart->startheure)->addMinutes($addMinutes);
// New Flight
$flight = new Flight();
$flight->configdepart_id = $configdepart->id;
$flight->num = $i;
$flight->heure = $newheure;
$flight->save();
// Cree les slots
for ($slotnum = 1; $slotnum <= $configdepart->slotbyflight; $slotnum++) {
$slot = new Slot();
$slot->flight_id = $flight->id;
$slot->num = $slotnum;
$slot->entree_id = 0;
$slot->save();
}
}
return true;
}
示例2: show
function show(Flight $flight)
{
if ($flight->missing) {
Messages::error('This flight has been missing for ' . Carbon::now()->diffInMinutes($flight->updated_at) . ' minutes. It will be deleted if it has been missing for 1 hour.')->one();
}
if ($flight->pilot->getOriginal('updated_at') == '0000-00-00 00:00:00') {
Queue::push('LegacyUpdate', $flight->pilot->vatsim_id, 'legacy');
$flight->pilot->processing = 2;
$flight->pilot->save();
}
$flightplan = new FlightPlan($flight->route, $flight->departure->lat, $flight->departure->lon, $flight->departure_id, $flight->arrival_id);
if (empty($flight->route_parsed)) {
$flight->route_parsed = $flightplan->toString();
$flight->save();
}
$flight->miles = $flight->distance * 0.54;
$this->javascript('assets/javascript/jquery.flot.min.js');
$this->javascript('assets/javascript/jquery.flot.time.min.js');
$this->stylesheet('assets/stylesheets/flightplan.css');
$this->autoRender(compact('flight', 'flightplan'), $flight->callsign);
}