* Return the flight fares if there are no subfleet fares #488 * Formatting * Formatting
This commit is contained in:
@@ -25,8 +25,8 @@ class MeasureExecutionTime implements Middleware
|
||||
// I assume you're using valid json in your responses
|
||||
// Then I manipulate them below
|
||||
$content = json_decode($response->getContent(), true) + [
|
||||
'execution_time' => $executionTime,
|
||||
];
|
||||
'execution_time' => $executionTime,
|
||||
];
|
||||
|
||||
// Change the content of your response
|
||||
$response->setData($content);
|
||||
|
||||
@@ -67,7 +67,7 @@ class File extends Model
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFilenameAttribute() :string
|
||||
public function getFilenameAttribute(): string
|
||||
{
|
||||
if (!$this->pathinfo) {
|
||||
$this->pathinfo = pathinfo($this->path);
|
||||
|
||||
@@ -146,7 +146,7 @@ class User extends Authenticatable
|
||||
}
|
||||
|
||||
return new File([
|
||||
'path' => $this->attributes['avatar'],
|
||||
'path' => $this->attributes['avatar'],
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,14 @@ class FareService extends Service
|
||||
$flight_fares = $this->getForFlight($flight);
|
||||
}
|
||||
|
||||
if (empty($subfleet)) {
|
||||
return $flight_fares;
|
||||
}
|
||||
|
||||
$subfleet_fares = $this->getForSubfleet($subfleet);
|
||||
if (empty($subfleet_fares) || $subfleet_fares->count() === 0) {
|
||||
return $flight_fares;
|
||||
}
|
||||
|
||||
// Go through all of the fares assigned by the subfleet
|
||||
// See if any of the same fares are assigned to the flight
|
||||
@@ -60,7 +67,7 @@ class FareService extends Service
|
||||
protected function getFares($fare)
|
||||
{
|
||||
if (filled($fare->pivot->price)) {
|
||||
if (substr_count($fare->pivot->price, '%', -1)) {
|
||||
if (strpos($fare->pivot->price, '%', -1) !== false) {
|
||||
$fare->price = Math::addPercent($fare->price, $fare->pivot->price);
|
||||
} else {
|
||||
$fare->price = $fare->pivot->price;
|
||||
@@ -68,7 +75,7 @@ class FareService extends Service
|
||||
}
|
||||
|
||||
if (filled($fare->pivot->cost)) {
|
||||
if (substr_count($fare->pivot->cost, '%', -1)) {
|
||||
if (strpos($fare->pivot->cost, '%', -1) !== false) {
|
||||
$fare->cost = Math::addPercent($fare->cost, $fare->pivot->cost);
|
||||
} else {
|
||||
$fare->cost = $fare->pivot->cost;
|
||||
@@ -76,7 +83,7 @@ class FareService extends Service
|
||||
}
|
||||
|
||||
if (filled($fare->pivot->capacity)) {
|
||||
if (substr_count($fare->pivot->capacity, '%', -1)) {
|
||||
if (strpos($fare->pivot->capacity, '%', -1) !== false) {
|
||||
$fare->capacity = Math::addPercent($fare->capacity, $fare->pivot->capacity);
|
||||
} else {
|
||||
$fare->capacity = $fare->pivot->capacity;
|
||||
|
||||
@@ -269,10 +269,10 @@ class PirepService extends Service
|
||||
foreach ($field_values as $fv) {
|
||||
PirepFieldValue::updateOrCreate(
|
||||
['pirep_id' => $pirep_id,
|
||||
'name' => $fv['name'],
|
||||
'name' => $fv['name'],
|
||||
],
|
||||
['value' => $fv['value'],
|
||||
'source' => $fv['source'],
|
||||
['value' => $fv['value'],
|
||||
'source' => $fv['source'],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user