当前位置: 首页>>代码示例>>PHP>>正文


PHP Application::make方法代码示例

本文整理汇总了PHP中Illuminate\Contracts\Foundation\Application::make方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::make方法的具体用法?PHP Application::make怎么用?PHP Application::make使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Contracts\Foundation\Application的用法示例。


在下文中一共展示了Application::make方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: attach

 /**
  * Instanciate and execute all functions as blade extends
  *
  * @param Application $app The current application
  */
 public static function attach(Application $app)
 {
     /** @var \Illuminate\View\Compilers\BladeCompiler $blade */
     $blade = $app->make('view')->getEngineResolver()->resolve('blade')->getCompiler();
     $config = $app->make('config');
     $class = new static();
     if (!isset($class->directivesFile)) {
         $class->directivesFile = __DIR__ . '/../directives.php';
     }
     $blacklist = isset($class->blacklist) ? $class->blacklist : $config->get('blade_extensions.blacklist');
     $directives = isset($class->directives) ? $class->directives : $app->make('files')->getRequire($class->directivesFile);
     $overrides = isset($class->overrides) ? $class->overrides : $config->get('blade_extensions.overrides', []);
     foreach ($overrides as $method => $override) {
         if (!isset($directives[$method])) {
             continue;
         }
         if (isset($override['pattern'])) {
             $directives[$method]['pattern'] = $override['pattern'];
         }
         if (isset($override['replacement'])) {
             $directives[$method]['replacement'] = $override['replacement'];
         }
     }
     foreach ($directives as $name => $directive) {
         $method = 'directive' . ucfirst($name);
         if (is_array($blacklist) && in_array($name, $blacklist, true) || !method_exists($class, $method)) {
             continue;
         }
         $blade->extend(function ($value) use($class, $method, $directive, $app, $blade) {
             return $class->{$method}($value, $directive['pattern'], $directive['replacement'], $app, $blade);
         });
     }
 }
开发者ID:elbakly,项目名称:blade-extensions,代码行数:38,代码来源:BladeExtenderTrait.php

示例2: getNamespace

 /**
  * @param $name
  * @throws UnexpectedValueException
  * @return \LaravelCommode\Bladed\Interfaces\IBladedCommand
  */
 public function getNamespace($name)
 {
     if (!array_key_exists($name, $this->namespaces)) {
         throw new UnexpectedValueException("Unknown blade command namespace - {$name}.");
     }
     return $this->application->make("{$this->iocRegistry}.{$name}");
 }
开发者ID:laravel-commode,项目名称:bladed,代码行数:12,代码来源:BladedCompiler.php

示例3: build

 /**
  * @param string $key
  *
  * @return RepositoryInterface
  */
 public function build($key)
 {
     $class = $this->registry->get($key);
     if ($class) {
         return $this->application->make($class);
     }
 }
开发者ID:Adamzynoni,项目名称:mybb2,代码行数:12,代码来源:RepositoryFactory.php

示例4: subscribe

 public function subscribe(Dispatcher $event)
 {
     if (static::$called) {
         return;
     }
     // only actively do something in case the default cache driver has been changed
     if ($this->settings->get('hyn.cache.driver', 'file') != 'file') {
         /** @var \Illuminate\Contracts\Config\Repository $config */
         $config = $this->application->make('config');
         $cacheConfig = ['driver' => $this->settings->get('hyn.cache.driver')];
         switch ($this->settings->get('hyn.cache.driver')) {
             case 'database':
                 $merge = ['table' => $this->settings->get('hyn.cache.table', 'cache'), 'connection' => $this->settings->get('hyn.cache.connection')];
                 break;
             case 'redis':
                 $merge = ['connection' => $this->settings->get('hyn.cache.connection')];
                 break;
             case 'memcached':
                 // @todo..
                 break;
             default:
                 $merge = [];
         }
         // merges driver specific settings into the config
         $cacheConfig = array_merge($cacheConfig, $merge);
         // sets the cache store
         $config->set('cache.stores.hyn-cache', $cacheConfig);
         $config->set('cache.driver', 'hyn-cache');
     }
 }
开发者ID:hyn,项目名称:flarum-cache,代码行数:30,代码来源:SetCacheDriver.php

示例5: __construct

 public function __construct($memcached, Application $app)
 {
     $this->memcached = $memcached;
     //force expiry to be in seconds from minutes
     $this->sessionExpiry = $app->make('config')->get('session.lifetime') * 60;
     $this->sessionPrefix = $app->make('config')->get('session.cookie');
 }
开发者ID:shinichi81,项目名称:elasticache-laravel,代码行数:7,代码来源:ElasticacheSessionHandler.php

示例6: resolve

 /**
  * Add a command, resolving through the application.
  *
  * @param string $command
  *
  * @return \Symfony\Component\Console\Command\Command
  */
 public function resolve($command)
 {
     if (is_null($this->container)) {
         $this->container = Container::getInstance();
     }
     return $this->add($this->container->make($command));
 }
开发者ID:notadd,项目名称:framework,代码行数:14,代码来源:Application.php

示例7: getMiddleware

 /**
  * {@inheritdoc}
  */
 protected function getMiddleware(Application $app)
 {
     $pipe = new MiddlewarePipe();
     $path = config('hyn.laravel-flarum.paths.api');
     //        if ($app->isInstalled() && $app->isUpToDate()) {
     $pipe->pipe($path, $app->make('Flarum\\Http\\Middleware\\ParseJsonBody'));
     $pipe->pipe($path, $app->make('Flarum\\Api\\Middleware\\FakeHttpMethods'));
     $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\\AuthenticateWithHeader'));
     $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.api.routes')]));
     $pipe->pipe($path, $app->make('Flarum\\Api\\Middleware\\HandleErrors'));
     //        } else {
     //            $pipe->pipe($path, function () {
     //                $document = new Document;
     //                $document->setErrors([
     //                    [
     //                        'code' => 503,
     //                        'title' => 'Service Unavailable'
     //                    ]
     //                ]);
     //
     //                return new JsonApiResponse($document, 503);
     //            });
     //        }
     return $pipe;
 }
开发者ID:hyn,项目名称:laravel-flarum,代码行数:33,代码来源:Server.php

示例8: getAbstractionLayer

 /**
  * {@inheritdoc}
  */
 public function getAbstractionLayer($modelName)
 {
     $modelInstance = $this->getModelInstance($modelName);
     $args = ['model' => $modelInstance];
     $dbal = $this->app->make('ANavallaSuiza\\Laravel\\Database\\Dbal\\Eloquent\\AbstractionLayer', $args);
     return $dbal;
 }
开发者ID:ablunier,项目名称:laravel-database,代码行数:10,代码来源:ModelManager.php

示例9: registerUserVerification

 /**
  * Register the user verification.
  *
  * @param  \Illuminate\Contracts\Foundation\Application  $app
  * @return void
  */
 protected function registerUserVerification(Application $app)
 {
     $app->bind('user.verification', function ($app) {
         return new UserVerification($app->make('mailer'), $app->make('db')->connection()->getSchemaBuilder());
     });
     $app->alias('user.verification', UserVerification::class);
 }
开发者ID:jrean,项目名称:laravel-user-verification,代码行数:13,代码来源:UserVerificationServiceProvider.php

示例10: loadConfig

 /**
  * Load configures from config file.
  */
 protected function loadConfig()
 {
     $config = $this->app->make('config');
     /**
      * How many entries per page.
      */
     $this->cacheLive = $config->get('housekeeper.repository.cache.live', 300);
 }
开发者ID:sandeeprajoria,项目名称:Housekeeper,代码行数:11,代码来源:AbstractCacheManager.php

示例11: handle

 /**
  * Handle an incoming request.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure                 $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->validator->validateRequest($request)) {
         $request = $this->app->make('Dingo\\Api\\Contract\\Http\\Request')->createFromIlluminate($request);
         return $this->sendRequestThroughRouter($request);
     }
     return $next($request);
 }
开发者ID:kyxer,项目名称:barrioosserver,代码行数:16,代码来源:Request.php

示例12: bootstrap

 /**
  * Bootstrap the given application.
  *
  * @param  \Illuminate\Contracts\Foundation\Application  $app
  *
  * @return void
  */
 public function bootstrap(Application $app)
 {
     if ($app->make('orchestra.extension.status')->is('safe')) {
         $app->make('orchestra.messages')->extend(function (MessageBag $messages) {
             $messages->add('info', trans('orchestra/foundation::response.safe-mode'));
         });
     }
 }
开发者ID:stevebauman,项目名称:foundation,代码行数:15,代码来源:NotifyIfSafeMode.php

示例13: boot

 /**
  * Function to boot indexer
  * @see
  */
 public function boot()
 {
     $this->events = $this->app->make('events');
     // Loop events
     foreach ($this->eloquentEvents as $event) {
         $this->events->listen('eloquent.' . $event . '*', ElasticListener::class . '@' . $event);
     }
 }
开发者ID:chaospower,项目名称:laravel-elastic-indexer,代码行数:12,代码来源:Ignite.php

示例14: call

 /**
  * Call the given URI and return a Response.
  *
  * @param  string $uri
  *
  * @return \Illuminate\Http\Response
  */
 protected function call($uri)
 {
     $request = Request::create($uri, 'GET');
     $kernel = $this->app->make(HttpKernel::class);
     $response = $kernel->handle($request);
     $kernel->terminate($request, $response);
     return $response;
 }
开发者ID:krisawzm,项目名称:critical-css,代码行数:15,代码来源:LaravelHtmlFetcher.php

示例15: getAllHooksImplementations

 private function getAllHooksImplementations()
 {
     $this->implementations = [];
     foreach ($this->getAllHooks() as $hookClass) {
         $this->implementations[] = $this->app->make($hookClass);
     }
     return $this->implementations;
 }
开发者ID:PhonemeCms,项目名称:cms,代码行数:8,代码来源:HookManager.php


注:本文中的Illuminate\Contracts\Foundation\Application::make方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。