本文整理匯總了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);
}