Merge remote-tracking branch 'origin/main' into fix-achievement-category-ordering
This commit is contained in:
@@ -7,6 +7,7 @@ use App\Models\IgnoredMissingLivery;
|
||||
use App\Models\User;
|
||||
use App\Models\UserFlight;
|
||||
use App\Services\AdminService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Inertia\Inertia;
|
||||
@@ -66,4 +67,17 @@ class AdminController extends Controller
|
||||
return back();
|
||||
}
|
||||
|
||||
public function ignoreMissingAirline(Request $request): JsonResponse
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'flight_id' => ['required', 'integer', 'exists:user_flights,id'],
|
||||
]);
|
||||
|
||||
$flight = UserFlight::findOrFail($validated['flight_id']);
|
||||
|
||||
$flight->ignoreMissingAirline()->firstOrCreate([]);
|
||||
|
||||
return response()->json(['status' => 'ok']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -245,15 +245,19 @@ class FlightController extends Controller
|
||||
$newFlight = auth()->user()->flights()->create($this->flightPayload($validated));
|
||||
|
||||
UserAction::create([
|
||||
'user_id' => $newFlight->user_id,
|
||||
'type' => $newFlight->departure_date->isFuture() ? 'flight_booked' : 'flight_logged',
|
||||
'data' => [
|
||||
'user_id' => $newFlight->user_id,
|
||||
'type' => $newFlight->departure_date->isFuture() ? 'flight_booked' : 'flight_logged',
|
||||
'data' => [
|
||||
'flight' => $newFlight->snapshot($newFlight->id),
|
||||
],
|
||||
]);
|
||||
|
||||
if ($request->boolean('add_more')) {
|
||||
return redirect()->route('flights.add')
|
||||
->with('success', 'Flight saved. Add another below.');
|
||||
}
|
||||
|
||||
return redirect()->route('profile.departure-board', [Auth::user()->name, $newFlight->id]);
|
||||
return redirect()->route('profile.flight', [Auth::user()->name, $newFlight->id]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user