Added "Save Flight And Add Another Button"
This commit is contained in:
@@ -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