/** * Bootstrap the application services. * * @return void */ public function boot(Kernel $kernel) { $this->publishes([__DIR__ . '/config' => config_path()], 'config'); $this->publishes([__DIR__ . '/migrations' => database_path('migrations')], 'migrations'); $this->app->booted(function () { $schedule = $this->app->make(Schedule::class); $schedule->command('firewall:flushtempips')->everyMinute(); }); $this->registerHelpers(); $kernel->prependMiddleware(Awescode\IPFirewall\FirewallMiddleware::class); new FirewallMiddleware(); }
/** * Bootstrap the application for artisan commands. * * @return void */ public function bootstrap() { if ($this->isInstalled() === false) { $this->resetForInstall(); } parent::bootstrap(); }
/** * [__construct description] * @param Application $app [description] * @param Router $router [description] */ public function __construct(Application $app, Router $router) { $this->routeMiddleware = Generate::routeMiddleware($this->routeMiddleware); $this->middleware = Generate::middleware([], $this->middleware); $this->middlewareGroups = Generate::middlewareGroups($this->middlewareGroups); parent::__construct($app, $router); }
/** * Inject our bootstrapper into the mix */ protected function bootstrappers() { $_stack = parent::bootstrappers(); // Insert our guy array_unshift($_stack, array_shift($_stack), ManagedInstance::class); return $_stack; }
/** * Handle an incoming HTTP request. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function handle($request) { try { return parent::handle($request); } catch (Exception $e) { throw $e; } }
/** * Bootstrap the application for HTTP requests. */ public function bootstrap() { parent::bootstrap(); $this->middleware = array_merge($this->middleware, app(AddonEnvironment::class)->addonHttpMiddlewares()); foreach (app(AddonEnvironment::class)->addonRouteMiddlewares() as $key => $middleware) { $this->router->middleware($key, $middleware); } }
/** * We need to replace the ConfigureLogging bootstrappers to use the custom * one. We’ll do this by overriding their respective constructors and * doing an array_walk to the bootstrappers property. * * @param Application $app * @param Router $router */ public function __construct(Application $app, Router $router) { parent::__construct($app, $router); array_walk($this->bootstrappers, function (&$bootstrapper) { if ($bootstrapper === 'Illuminate\\Foundation\\Bootstrap\\ConfigureLogging') { $bootstrapper = 'Bootstrap\\ConfigureLogging'; } }); }
/** * Create a new Kernel instance. * * @param Application $app * @param Router $router */ public function __construct(Application $app, Router $router) { $this->defineLocale(); $config = (require base_path('config/streams.php')); $this->middleware = array_get($config, 'middleware') ?: $this->middleware; $this->routeMiddleware = array_get($config, 'route_middleware') ?: $this->routeMiddleware; $this->middlewareGroups = array_get($config, 'middleware_groups') ?: $this->middlewareGroups; $this->middlewarePriority = array_get($config, 'middleware_priority') ?: $this->middlewarePriority; parent::__construct($app, $router); }
public function __construct(Application $app, Router $router) { parent::__construct($app, $router); // TODO: Change the autogenerated stub array_walk($this->bootstrappers, function (&$bootstrapper) { if ($bootstrapper === 'Illuminate\\Foundation\\Bootstrap\\ConfigureLogging') { $bootstrapper = 'App\\Services\\ConfigureLogging'; } }); }
/** * Get the route dispatcher callback. * * @return \Closure */ protected function dispatchToRouter() { // Reconstruct the kernel and reset the class' router to use our new // extended router which got instantiated and bound into the IoC after // the default router got set up and bound. This might look kinda odd, // but poses no direct consequences. parent::__construct($this->app, $this->app->make('router')); // Continue as normal return parent::dispatchToRouter(); }
public function handle($request) { try { return parent::handle($request); } catch (\Symfony\Component\HttpKernel\Exception\NotFoundHttpException $e) { return response()->view('error.404', [], 404); } catch (Exception $e) { $this->reportException($e); return $this->renderException($request, $e); } }
/** * Registers global middleware for the CMS API. * * @return $this */ protected function registerCmsApiGroupMiddleware() { $this->router->middlewareGroup($this->getConfiguredApiGroupName(), []); foreach ($this->getGlobalApiMiddleware() as $middleware) { // Don't add if the middleware is already globally enabled in the kernel if ($this->kernel->hasMiddleware($middleware)) { continue; } $this->router->pushMiddlewareToGroup($this->getConfiguredApiGroupName(), $middleware); } return $this; }
/** * Bootstrap the application events. * * @param Router $router * @param Kernel $kernel * @return void */ public function boot(Router $router, Kernel $kernel) { // add router middleware $globalMiddleware = [UploadChecks::class]; $routerMiddleware = ['coaster.admin' => AdminAuth::class, 'coaster.guest' => GuestAuth::class]; event(new LoadMiddleware($globalMiddleware, $routerMiddleware)); foreach ($globalMiddleware as $globalMiddlewareClass) { $kernel->pushMiddleware($globalMiddlewareClass); } foreach ($routerMiddleware as $routerMiddlewareName => $routerMiddlewareClass) { $router->middleware($routerMiddlewareName, $routerMiddlewareClass); } // use coater guard and user provider $authGuard = Helpers\Cms\CoasterGuard::class; $authUserProvider = Providers\CoasterAuthUserProvider::class; event(new LoadAuth($authGuard, $authUserProvider)); if ($authGuard && $authUserProvider) { Auth::extend('coaster', function ($app) use($authGuard, $authUserProvider) { return new $authGuard('coasterguard', new $authUserProvider(), $app['session.store'], $app['request']); }); } // set cookie jar for cookies Auth::setCookieJar($this->app['cookie']); // load coaster views $adminViews = [base_path(trim(config('coaster::admin.view'), '/'))]; $frontendViews = [base_path(trim(config('coaster::frontend.view'), '/'))]; event(new SetViewPaths($adminViews, $frontendViews)); $this->loadViewsFrom($adminViews, 'coaster'); $this->loadViewsFrom($frontendViews, 'coasterCms'); // run routes if not in console $routeFile = __DIR__ . '/Http/routes.php'; event(new LoadRouteFile($routeFile)); if ($routeFile && file_exists($routeFile)) { include $routeFile; } // if in console and not installed, display notice if (App::runningInConsole() && !Install::isComplete()) { echo "Coaster Framework: CMS awaiting install, go to a web browser to complete installation\r\n"; } }
public function __construct(Application $app, Router $router) { $this->defineLocale(); parent::__construct($app, $router); }
public function handle($request) { return parent::handle($request); }
/** @inheritdoc */ public function pushMiddleware(Kernel $kernel) { foreach ($this->middleware as $_middleware) { $kernel->pushMiddleware($_middleware); } return $this; }
public function __construct(\Illuminate\Contracts\Foundation\Application $app, \Illuminate\Routing\Router $router) { parent::__construct($app, $router); }