diff --git a/app/Console/Commands/UpdateDepartedFlights.php b/app/Console/Commands/UpdateDepartedFlights.php
index 7658dd8..4ff323d 100644
--- a/app/Console/Commands/UpdateDepartedFlights.php
+++ b/app/Console/Commands/UpdateDepartedFlights.php
@@ -32,6 +32,7 @@ class UpdateDepartedFlights extends Command
foreach ($userFlights as $flight) {
$flight->update(['departure_processed_at' => $now]);
+ $this->notifyFollowersOnDeparture($flight);
}
}
@@ -41,7 +42,10 @@ class UpdateDepartedFlights extends Command
$title = "{$user->name} is taking off!";
$flightNumber = $flight->flight_number ? "On {$flight->flight_number} from" : 'From';
$body = "{$flightNumber} {$flight->departureAirport->municipality} → {$flight->arrivalAirport->municipality}";
- $url = route('profile.flight', [$flight->id]);
+ $url = route('profile.flight', [
+ 'user' => $user->id,
+ 'userFlight' => $flight->id,
+ ]);
$user->followers()->get()->each(function (User $follower) use ($title, $body, $url) {
$notify = $follower->getSetting('notify_on_flight_departure');
@@ -55,7 +59,6 @@ class UpdateDepartedFlights extends Command
]);
}
- }
- );
+ });
}
}
diff --git a/app/Http/Controllers/FlightImportController.php b/app/Http/Controllers/FlightImportController.php
index dc91857..ab9f0fc 100644
--- a/app/Http/Controllers/FlightImportController.php
+++ b/app/Http/Controllers/FlightImportController.php
@@ -169,6 +169,7 @@ class FlightImportController extends Controller
'flight_class' => $flightToReconcile->flight_class !== null ? (int) $flightToReconcile->flight_class : null,
'seat_type' => $flightToReconcile->seat_type !== null ? (int) $flightToReconcile->seat_type : null,
'flight_reason' => $flightToReconcile->flight_reason !== null ? (int) $flightToReconcile->flight_reason : null,
+ 'seat_number' => $flightToReconcile->seat_number ?? '',
'airline_options' => $this->getPossibleAirlines($flightToReconcile->airline ?? ''),
'to_options' => $this->getPossibleAirports($flightToReconcile->to ?? ''),
'from_options' => $this->getPossibleAirports($flightToReconcile->from ?? ''),
@@ -380,7 +381,7 @@ class FlightImportController extends Controller
$handle = fopen($path, 'r');
- fgetcsv($handle);
+ fgetcsv($handle); // skip blank first line
// Read and normalise header row
$headers = array_map(
@@ -389,9 +390,6 @@ class FlightImportController extends Controller
);
\Log::debug('CSV headers', $headers);
- $firstRow = fgetcsv($handle);
- \Log::debug('First row', $firstRow ?? ['empty']);
- \Log::debug('Header count: ' . count($headers) . ', Row count: ' . count($firstRow ?? []));
$map = [
'date' => 'date',
@@ -415,6 +413,11 @@ class FlightImportController extends Controller
$imported = 0;
while (($row = fgetcsv($handle)) !== false) {
+ if ($imported === 0) {
+ \Log::debug('First row', $row);
+ \Log::debug('Header count: ' . count($headers) . ', Row count: ' . count($row));
+ }
+
if (count($row) !== count($headers)) {
continue; // skip malformed rows
}
diff --git a/app/Policies/UserFlightPolicy.php b/app/Policies/UserFlightPolicy.php
index 72d6bf7..9d00a81 100644
--- a/app/Policies/UserFlightPolicy.php
+++ b/app/Policies/UserFlightPolicy.php
@@ -45,7 +45,7 @@ class UserFlightPolicy
*/
public function delete(User $user, UserFlight $userFlight): bool
{
- return $user->id === $userFlight->user_id;
+ return ($user->id === $userFlight->user_id) || $user->hasRole('admin');
}
/**
diff --git a/resources/js/Pages/ReconcileFlight.vue b/resources/js/Pages/ReconcileFlight.vue
index 7a39b5c..a3608ac 100644
--- a/resources/js/Pages/ReconcileFlight.vue
+++ b/resources/js/Pages/ReconcileFlight.vue
@@ -191,6 +191,7 @@ watch(() => form.flight_reason, (val) => console.log('flight_reason changed:', v
+ {{console.log(form.flight_reason)}}