public function key($id, EditShuttleKeyRequest $request, FlashNotifier $flash) { $shuttle = Shuttle::findOrFail($id); $shuttle->key = $request->get('key'); $flash->success('Shuttle key successfully modified!'); return back(); }
public function destroy($id, FlashNotifier $notifier) { $trip = Trip::findOrFail($id); if ($trip->passengers()->count() > 0) { $notifier->error('That trip already has passengers. No way we can delete it...'); return back(); } $trip->delete(); $notifier->success('Trip successfully deleted!'); return back(); }
public function destroy(Request $request, FlashNotifier $flash) { $trip = Trip::findOrFail($request->get('trip_id')); try { $this->bookingService->cancel(Auth::user(), $trip); $flash->success("Your reservation from {$trip->origin} to {$trip->destination} was canceled."); } catch (\Exception $e) { $flash->error("There was an error processing your request"); } return redirect()->back(); }
/** * Flash a success message. * * @param string $message * @return $this * @static */ public static function success($message) { return \Laracasts\Flash\FlashNotifier::success($message); }
/** * @param string $message */ public function successMessage(string $message) { $this->flashNotifier->success($message); }