make() 공개 메소드

(Overriding Container::make)
public make ( string $abstract, array $parameters = [] ) : mixed
$abstract string
$parameters array
리턴 mixed
예제 #1
0
파일: Server.php 프로젝트: Albert221/core
 /**
  * {@inheritdoc}
  */
 protected function getMiddleware(Application $app)
 {
     $pipe = new MiddlewarePipe();
     $path = parse_url($app->url(), PHP_URL_PATH);
     $errorDir = __DIR__ . '/../../error';
     if (!$app->isInstalled()) {
         $app->register('Flarum\\Install\\InstallServiceProvider');
         $pipe->pipe($path, $app->make('Flarum\\Http\\Middleware\\StartSession'));
         $pipe->pipe($path, $app->make('Flarum\\Http\\Middleware\\DispatchRoute', ['routes' => $app->make('flarum.install.routes')]));
         $pipe->pipe($path, new HandleErrors($errorDir, true));
     } elseif ($app->isUpToDate() && !$app->isDownForMaintenance()) {
         $pipe->pipe($path, $app->make('Flarum\\Http\\Middleware\\ParseJsonBody'));
         $pipe->pipe($path, $app->make('Flarum\\Http\\Middleware\\StartSession'));
         $pipe->pipe($path, $app->make('Flarum\\Http\\Middleware\\RememberFromCookie'));
         $pipe->pipe($path, $app->make('Flarum\\Http\\Middleware\\AuthenticateWithSession'));
         $pipe->pipe($path, $app->make('Flarum\\Http\\Middleware\\SetLocale'));
         event(new ConfigureMiddleware($pipe, $path, $this));
         $pipe->pipe($path, $app->make('Flarum\\Http\\Middleware\\DispatchRoute', ['routes' => $app->make('flarum.forum.routes')]));
         $pipe->pipe($path, new HandleErrors($errorDir, $app->inDebugMode()));
     } else {
         $pipe->pipe($path, function () use($errorDir) {
             return new HtmlResponse(file_get_contents($errorDir . '/503.html', 503));
         });
     }
     return $pipe;
 }
예제 #2
0
파일: Server.php 프로젝트: johnulist/core
 /**
  * {@inheritdoc}
  */
 protected function getMiddleware(Application $app)
 {
     $pipe = new MiddlewarePipe();
     if ($app->isInstalled()) {
         $app->register('Flarum\\Admin\\AdminServiceProvider');
         $adminPath = parse_url($app->url('admin'), PHP_URL_PATH);
         $routes = $app->make('flarum.admin.routes');
         $pipe->pipe($adminPath, $app->make('Flarum\\Http\\Middleware\\AuthenticateWithCookie'));
         $pipe->pipe($adminPath, $app->make('Flarum\\Http\\Middleware\\ParseJsonBody'));
         $pipe->pipe($adminPath, $app->make('Flarum\\Admin\\Middleware\\RequireAdministrateAbility'));
         $pipe->pipe($adminPath, $app->make('Flarum\\Http\\Middleware\\DispatchRoute', compact('routes')));
         $pipe->pipe(new HandleErrors(__DIR__ . '/../../error', $app->inDebugMode()));
     }
     return $pipe;
 }
예제 #3
0
파일: Server.php 프로젝트: johnulist/core
 /**
  * {@inheritdoc}
  */
 protected function getMiddleware(Application $app)
 {
     $pipe = new MiddlewarePipe();
     $installed = $app->isInstalled();
     $basePath = parse_url($app->url(), PHP_URL_PATH);
     if ($installed) {
         $app->register('Flarum\\Forum\\ForumServiceProvider');
         $routes = $app->make('flarum.forum.routes');
         $pipe->pipe($basePath, $app->make('Flarum\\Http\\Middleware\\AuthenticateWithCookie'));
         $pipe->pipe($basePath, $app->make('Flarum\\Http\\Middleware\\ParseJsonBody'));
     } else {
         $app->register('Flarum\\Install\\InstallServiceProvider');
         $routes = $app->make('flarum.install.routes');
     }
     $pipe->pipe($basePath, $app->make('Flarum\\Http\\Middleware\\DispatchRoute', compact('routes')));
     $pipe->pipe(new HandleErrors(__DIR__ . '/../../error', $app->inDebugMode() || !$installed));
     return $pipe;
 }
예제 #4
0
파일: Server.php 프로젝트: asifalimd/core
 /**
  * {@inheritdoc}
  */
 protected function getMiddleware(Application $app)
 {
     $pipe = new MiddlewarePipe();
     $apiPath = parse_url($app->url('api'), PHP_URL_PATH);
     if ($app->isInstalled() && $app->isUpToDate()) {
         $pipe->pipe($apiPath, $app->make('Flarum\\Http\\Middleware\\ParseJsonBody'));
         $pipe->pipe($apiPath, $app->make('Flarum\\Api\\Middleware\\FakeHttpMethods'));
         $pipe->pipe($apiPath, $app->make('Flarum\\Http\\Middleware\\StartSession'));
         $pipe->pipe($apiPath, $app->make('Flarum\\Http\\Middleware\\RememberFromCookie'));
         $pipe->pipe($apiPath, $app->make('Flarum\\Http\\Middleware\\AuthenticateWithSession'));
         $pipe->pipe($apiPath, $app->make('Flarum\\Http\\Middleware\\AuthenticateWithHeader'));
         $pipe->pipe($apiPath, $app->make('Flarum\\Http\\Middleware\\SetLocale'));
         $pipe->pipe($apiPath, $app->make('Flarum\\Http\\Middleware\\DispatchRoute', ['routes' => $app->make('flarum.api.routes')]));
         $pipe->pipe($apiPath, $app->make('Flarum\\Api\\Middleware\\HandleErrors'));
     } else {
         $pipe->pipe($apiPath, function () {
             $document = new Document();
             $document->setErrors([['code' => 503, 'title' => 'Service Unavailable']]);
             return new JsonApiResponse($document, 503);
         });
     }
     return $pipe;
 }
예제 #5
0
파일: Server.php 프로젝트: asifalimd/core
 /**
  * {@inheritdoc}
  */
 protected function getMiddleware(Application $app)
 {
     $pipe = new MiddlewarePipe();
     if ($app->isInstalled()) {
         $adminPath = parse_url($app->url('admin'), PHP_URL_PATH);
         $errorDir = __DIR__ . '/../../error';
         if ($app->isUpToDate()) {
             $pipe->pipe($adminPath, $app->make('Flarum\\Http\\Middleware\\ParseJsonBody'));
             $pipe->pipe($adminPath, $app->make('Flarum\\Http\\Middleware\\StartSession'));
             $pipe->pipe($adminPath, $app->make('Flarum\\Http\\Middleware\\RememberFromCookie'));
             $pipe->pipe($adminPath, $app->make('Flarum\\Http\\Middleware\\AuthenticateWithSession'));
             $pipe->pipe($adminPath, $app->make('Flarum\\Http\\Middleware\\SetLocale'));
             $pipe->pipe($adminPath, $app->make('Flarum\\Admin\\Middleware\\RequireAdministrateAbility'));
             $pipe->pipe($adminPath, $app->make('Flarum\\Http\\Middleware\\DispatchRoute', ['routes' => $app->make('flarum.admin.routes')]));
             $pipe->pipe($adminPath, new HandleErrors($errorDir, $app->inDebugMode()));
         } else {
             $app->register('Flarum\\Update\\UpdateServiceProvider');
             $pipe->pipe($adminPath, $app->make('Flarum\\Http\\Middleware\\DispatchRoute', ['routes' => $app->make('flarum.update.routes')]));
             $pipe->pipe($adminPath, new HandleErrors($errorDir, true));
         }
     }
     return $pipe;
 }
예제 #6
0
파일: Server.php 프로젝트: johnulist/core
 /**
  * {@inheritdoc}
  */
 protected function getMiddleware(Application $app)
 {
     $pipe = new MiddlewarePipe();
     if ($app->isInstalled()) {
         $app->register('Flarum\\Api\\ApiServiceProvider');
         $routes = $app->make('flarum.api.routes');
         $apiPath = parse_url($app->url('api'), PHP_URL_PATH);
         $pipe->pipe($apiPath, $app->make('Flarum\\Http\\Middleware\\AuthenticateWithCookie'));
         $pipe->pipe($apiPath, $app->make('Flarum\\Api\\Middleware\\AuthenticateWithHeader'));
         $pipe->pipe($apiPath, $app->make('Flarum\\Http\\Middleware\\ParseJsonBody'));
         $pipe->pipe($apiPath, $app->make('Flarum\\Api\\Middleware\\FakeHttpMethods'));
         $pipe->pipe($apiPath, $app->make('Flarum\\Http\\Middleware\\DispatchRoute', compact('routes')));
         $pipe->pipe($apiPath, $app->make('Flarum\\Api\\Middleware\\HandleErrors'));
     }
     return $pipe;
 }
예제 #7
0
 /**
  * @param Application $app
  */
 protected function registerCache(Application $app)
 {
     $app->singleton('cache.store', function ($app) {
         return new \Illuminate\Cache\Repository($app->make('cache.filestore'));
     });
     $app->singleton('cache.filestore', function ($app) {
         return new \Illuminate\Cache\FileStore(new \Illuminate\Filesystem\Filesystem(), $app->storagePath() . '/cache');
     });
     $app->alias('cache.filestore', 'Illuminate\\Contracts\\Cache\\Store');
     $app->alias('cache.store', 'Illuminate\\Contracts\\Cache\\Repository');
 }
 /**
  * @param ConfigureMiddleware $event
  */
 public function whenConfigureMiddleware(ConfigureMiddleware $event)
 {
     $event->pipe->pipe($event->path, $this->app->make(Autologin::class));
 }