Save user flights

This commit is contained in:
2026-04-05 16:40:19 +10:00
parent 8a1581641b
commit e55c771318
6 changed files with 68 additions and 56 deletions
@@ -13,6 +13,7 @@ use App\Models\UserFlight;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Inertia\Inertia;
class FlightImportController extends Controller
{
@@ -168,7 +169,7 @@ class FlightImportController extends Controller
$validated = $request->validate([
'date' => 'required|date',
'imported_flight_id' => 'required|exists:imported_flights,id',
'flight_number' => 'required|string',
'flight_number' => 'nullable|string',
'from_id' => 'required|integer|exists:airports,id',
'to_id' => 'required|integer|exists:airports,id',
'dep_time' => 'nullable|date_format:H:i',
@@ -238,15 +239,14 @@ class FlightImportController extends Controller
'aircraft_id' => $validated['aircraft_id'] ?? null,
'aircraft_registration' => $validated['registration'] ?? null,
'seat_number' => $validated['seat_number'] ?? null,
'seat_type_id' => $validated['seat_type_id'] ?? null,
'flight_class_id' => $validated['flight_class_id'] ?? null,
'flight_reason_id' => $validated['flight_reason_id'] ?? null,
'seat_type_id' => $validated['seat_type_id'] ?? 0,
'flight_class_id' => $validated['flight_class_id'] ?? 0,
'flight_reason_id' => $validated['flight_reason_id'] ?? 0,
'note' => $validated['note'] ?? null,
]);
ImportedFlight::destroy($validated['imported_flight_id']);
return redirect()->route('reconcile');
return to_route('reconcile');
}
+2 -2
View File
@@ -18,7 +18,7 @@ class SearchController extends Controller
->orWhere('IATA_code', 'ilike', "%{$q}%")
->orWhere('ICAO_code', 'ilike', "%{$q}%");
})
->limit(15)
->limit(50)
->get(['id', 'name', 'IATA_code', 'ICAO_code', 'logo'])
->map(fn($a) => [
'value' => $a->id,
@@ -33,7 +33,7 @@ class SearchController extends Controller
return Aircraft::where('designator', 'ilike', "%{$q}%")
->orWhereRaw("CONCAT(manufacturer_code, ' ', model_full_name) ilike ?", ["%{$q}%"])
->limit(15)
->limit(200)
->get(['id', 'manufacturer_code', 'model_full_name', 'designator'])
->map(fn($a) => [
'value' => $a->id,