protected function whoopsHandler()
    {
        return tap(new PrettyPageHandler(), function ($handler) {
            $files = new Filesystem();
            $handler->handleUnconditionally(true);

            foreach (config('app.debug_blacklist', []) as $key => $secrets) {
                foreach ($secrets as $secret) {
                    $handler->blacklist($key, $secret);
                }
            }

            if (config('app.editor', false)) {
                $handler->setEditor(config('app.editor'));
            }

            $handler->setApplicationPaths(
                array_flip(Arr::except(
                    array_flip($files->directories(base_path())),
                    [base_path('vendor')]
                ))
            );
        });
    }