/**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (Auth::user()->isLaunchController() || Auth::isAdmin()) {
         return $next($request);
     }
     return redirect('/');
 }
 public function delete($object_id, $comment_id)
 {
     $comment = Comment::find($comment_id);
     // Make sure that the request for deletion is either coming from an admin or from the user who owns the comment
     // and that it isn't already trashed
     if ((Auth::isAdmin() || $comment->user_id == Auth::id()) && !$comment->trashed()) {
         $comment->delete();
         return response()->json(null, 204);
     }
     return response()->json(null, 402);
 }
 /**
  * GET, /live. Fetches SpaceXStats Live.
  *
  * @return \Illuminate\View\View
  */
 public function live()
 {
     $isAuthed = Auth::check() && Auth::user()->isLaunchController() || Auth::isAdmin();
     $js = ['auth' => $isAuthed, 'mission' => Mission::future()->first(), 'isActive' => Redis::get('live:active') == true, 'updates' => collect(Redis::lrange('live:updates', 0, -1))->map(function ($update) {
         return json_decode($update);
     }), 'countdown' => Redis::hgetall('live:countdown'), 'title' => Redis::get('live:title'), 'reddit' => Redis::hgetall('live:reddit'), 'sections' => json_decode(Redis::get('live:sections')), 'resources' => json_decode(Redis::get('live:resources')), 'description' => Redis::hgetall('live:description'), 'streams' => ['spacex' => json_decode(Redis::hget('live:streams', 'spacex')), 'spacexClean' => json_decode(Redis::hget('live:streams', 'spacexClean')), 'nasa' => json_decode(Redis::hget('live:streams', 'nasa'))], 'status' => ['text' => Redis::get('live:status')]];
     if ($isAuthed) {
         $js['cannedResponses'] = Redis::hgetall('live:cannedResponses');
     }
     JavaScript::put($js);
     return view('live');
 }