Пример #1
0
 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();
 }
Пример #2
0
 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();
 }
Пример #3
0
 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();
 }
Пример #4
0
 public function toggleDriver($id, FlashNotifier $flash)
 {
     $user = User::find($id);
     if ($user->isDriver() && $user->drives()->future()->count() > 0) {
         $flash->error("{$user->name} has Trips he needs to drive so he must stay a driver.");
         return back();
     }
     $user->is_driver = !$user->is_driver;
     $user->save();
     return back();
 }
Пример #5
0
 /**
  * Add an "important" flash to the session.
  *
  * @return $this 
  * @static 
  */
 public static function important()
 {
     return \Laracasts\Flash\FlashNotifier::important();
 }
Пример #6
0
 /**
  * 
  *
  * @param $message
  * @param string $level
  * @static 
  */
 public static function message($message, $level = 'info', $title = 'Notice')
 {
     return \Laracasts\Flash\FlashNotifier::message($message, $level, $title);
 }
Пример #7
0
 /**
  * @param string $message
  */
 public function warningMessage(string $message)
 {
     $this->flashNotifier->warning($message);
 }