예제 #1
0
 public function postAdd(Request $request)
 {
     $airport = $request->input('icao');
     $airportId = Airport::where('icao', $airport)->first();
     $airline = Airline::find(Session::get('airlineId'));
     $airline->airports()->save($airportId);
     return view('staff.airports.dashboard');
 }
예제 #2
0
 /**
  * Register any application services.
  *
  * This service provider is a great spot to register your various container
  * bindings with the application. As you can see, we are registering our
  * "Registrar" implementation here. You can add your own bindings too!
  *
  * @return void
  */
 public function register()
 {
     Airline::setStripeKey(env('STRIPE_KEY'));
     Stripe::setApiKey(env('STRIPE_KEY'));
     $this->app->bind('Illuminate\\Contracts\\Auth\\Registrar', 'vAMSYS\\Services\\Registrar');
     $this->app->bind('vAMSYS\\Contracts\\Route', 'vAMSYS\\Services\\Route');
     $this->app->bind('vAMSYS\\Contracts\\SmartCARS', 'vAMSYS\\Services\\SmartCARS');
     $this->app->bind('vAMSYS\\Contracts\\Callsign', 'vAMSYS\\Services\\Callsign');
     $this->app->bind('vAMSYS\\Contracts\\PirepParser', 'vAMSYS\\Services\\PirepParser');
 }
예제 #3
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $airline = Airline::find(Session::get('airlineId'));
     if (!UserRepository::hasRole($airline->prefix . '-staff', $this->auth->user())) {
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             return redirect('/');
         }
     }
     return $next($request);
 }
예제 #4
0
 /**
  * Bind data to the view.
  *
  * @param  View  $view
  * @return void
  */
 public function compose(View $view)
 {
     // Are we connecting from a known URL?
     if ($airline = Airline::where('url', '=', Request::getHttpHost())->first()) {
         Session::put('airlineId', $airline->id);
     }
     if (Session::has('airlineId')) {
         $view->with('airline', Airline::find(Session::get('airlineId')));
     }
     if (Request::user()) {
         $view->with('user', Request::user());
         $view->with('pilot', PilotRepository::getCurrentPilot());
         $airline = Airline::find(Session::get('airlineId'));
         $view->with('airlineStaff', UserRepository::hasRole($airline->prefix . '-staff', Request::user()));
     }
 }
예제 #5
0
 public static function getCurrentPilot()
 {
     return Pilot::where('user_id', '=', Request::user()->id)->where('airline_id', '=', Airline::find(Session::get('airlineId'))->id)->first();
 }
예제 #6
0
 public function getScoring()
 {
     $airline = Airline::find(Session::get('airlineId'));
     return view('staff.settings.scoringRules', ['scoringRulesJSON' => json_encode($airline->scoring_rules['rules'])]);
 }