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


PHP Container::make方法代码示例

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


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

示例1: make

 public function make(RequestContainer $requestContainer, Container $app)
 {
     if ($requestContainer->getId()) {
         return new InstanceQuery($app->make('query_builders'), $requestContainer);
     }
     return new CollectionQuery($app->make('query_builders'), $requestContainer);
 }
开发者ID:indatus,项目名称:ranger,代码行数:7,代码来源:QueryExecuterFactory.php

示例2: getContainer

 /**
  * Get the IoC Container
  *
  * @param string $make A dependency to fetch
  *
  * @return Container
  */
 public static function getContainer($make = null)
 {
     if ($make) {
         return static::$container->make($make);
     }
     return static::$container;
 }
开发者ID:julien-c,项目名称:mongovel,代码行数:14,代码来源:Mongovel.php

示例3: getValidatorInstance

 /**
  * Get the validator instance for the request.
  *
  * @param array $rules
  * @param array $messages
  * @param array $customAttributes
  * @return Validator
  */
 protected function getValidatorInstance(array $rules, array $messages = array(), array $customAttributes = array())
 {
     $factory = $this->app->make('Illuminate\\Contracts\\Validation\\Factory');
     $validator = $factory->make([], $rules, $messages, $customAttributes);
     $validator->addCustomAttributes($customAttributes);
     return $validator;
 }
开发者ID:suhe,项目名称:bdoportal,代码行数:15,代码来源:JsValidatorFactory.php

示例4: __construct

 /**
  * ExtensionRegistrar constructor.
  */
 public function __construct()
 {
     $this->container = $this->getContainer();
     $this->events = $this->container->make('events');
     $this->router = $this->container->make('router');
     $this->setting = $this->container->make('setting');
 }
开发者ID:notadd,项目名称:framework,代码行数:10,代码来源:ExtensionRegistrar.php

示例5: execute

 /**
  * Execute the required command against the command handler.
  *
  * @param Command $command
  * @return mixed
  */
 public function execute(Command $command)
 {
     $handler = $this->commandTranslator->getCommandHandler($command);
     $commandName = $this->getCommandName($command);
     $this->log->info("New command [{$commandName}]", get_object_vars($command));
     return $this->app->make($handler)->handle($command);
 }
开发者ID:tectonic,项目名称:application-support,代码行数:13,代码来源:DefaultCommandBus.php

示例6: makeProvidersCollection

 /**
  * @param array $keys
  * @return \LW\Statistics\StatisticsProviderCollection
  */
 protected function makeProvidersCollection($keys)
 {
     $collection = new StatisticsProviderCollection();
     foreach ($keys as $name) {
         $collection->add($name, $this->container->make($this->providerMap[$name]));
     }
     return $collection;
 }
开发者ID:legalweb,项目名称:php-statistics-helper,代码行数:12,代码来源:ProvidersHelper.php

示例7: makeModel

 /**
  * Refresh modal object.
  *
  * @throws RepositoryException
  *
  * @return Model
  */
 public function makeModel()
 {
     $model = $this->app->make($this->model());
     if (!$model instanceof Model) {
         throw new RepositoryException("Class {$this->model()} must be an instance of Illuminate\\Database\\Eloquent\\Model");
     }
     return $this->model = $model;
 }
开发者ID:LavaliteCms,项目名称:Example,代码行数:15,代码来源:BaseRepository.php

示例8: callWithinStack

 /**
  * Call the given controller instance method.
  *
  * @param  \Illuminate\Routing\Controller  $instance
  * @param  \Illuminate\Routing\Route  $route
  * @param  \Illuminate\Http\Request  $request
  * @param  string  $method
  * @return mixed
  */
 protected function callWithinStack($instance, $route, $request, $method)
 {
     $middleware = $this->getMiddleware($instance, $method);
     $shouldSkipMiddleware = $this->container->bound('middleware.disable') && $this->container->make('middleware.disable') === true;
     return (new Pipeline($this->container))->send($request)->through($shouldSkipMiddleware ? [] : $middleware)->then(function ($request) use($instance, $route, $method) {
         return $this->router->prepareResponse($request, $this->call($instance, $route, $method));
     });
 }
开发者ID:musefind,项目名称:framework,代码行数:17,代码来源:ControllerDispatcher.php

示例9: getValidatorInstance

 /**
  * Get the validator instance for the request.
  *
  * @return \Illuminate\Contracts\Validation\Validator
  */
 protected function getValidatorInstance()
 {
     $factory = $this->container->make(ValidationFactory::class);
     if (method_exists($this, 'validator')) {
         return $this->container->call([$this, 'validator'], compact('factory'));
     }
     return $factory->make($this->all(), $this->container->call([$this, 'rules']), $this->messages(), $this->attributes());
 }
开发者ID:ziracmo,项目名称:Projet-transversal-2,代码行数:13,代码来源:FormRequest.php

示例10: getValidatorInstance

 /**
  * Get the validator instance for the request.
  *
  * @return \Illuminate\Validation\Validator
  */
 protected function getValidatorInstance()
 {
     $factory = $this->container->make('Illuminate\\Validation\\Factory');
     if (method_exists($this, 'validator')) {
         return $this->container->call([$this, 'validator'], compact('factory'));
     }
     return $factory->make($this->all(), $this->container->call([$this, 'rules']), $this->messages());
 }
开发者ID:hramose,项目名称:Sistema-Control-de-Almacen,代码行数:13,代码来源:FormRequest.php

示例11: makeCriteria

 /**
  * @param       $class
  * @param array $args
  * @return mixed
  * @throws RepositoryException
  */
 protected function makeCriteria($class, array $args)
 {
     $criteria = $this->app->make($class, $args);
     if (!$criteria instanceof CriteriaContract) {
         throw new RepositoryException("Class {$class} must be an instance of GuilhermeGonzaga\\Repository\\Criteria\\Criteria");
     }
     return $criteria;
 }
开发者ID:guilhermegonzaga,项目名称:repository,代码行数:14,代码来源:Repository.php

示例12: parseIncludes

 /**
  * @return $this
  */
 protected function parseIncludes()
 {
     $request = $this->application->make('Illuminate\\Http\\Request');
     $paramIncludes = Config::get('reloquent.fractal.params.include', 'include');
     if ($request->has($paramIncludes)) {
         $this->fractal->parseIncludes($request->get($paramIncludes));
     }
     return $this;
 }
开发者ID:mayconbordin,项目名称:reloquent,代码行数:12,代码来源:FractalPresenter.php

示例13: __construct

 /**
  * Constructor.
  *
  * @param array     $viewPaths
  * @param string    $cachePath
  * @param Container $container
  */
 public function __construct($viewPaths, $cachePath, ContainerInterface $container = null)
 {
     $this->viewPaths = $viewPaths;
     $this->cachePath = $cachePath;
     $this->container = $container ?: new Container();
     $this->setupContainer();
     (new ViewServiceProvider($this->container))->register();
     $this->engineResolver = $this->container->make('view.engine.resolver');
 }
开发者ID:jenssegers,项目名称:blade,代码行数:16,代码来源:Blade.php

示例14: resolve

 /**
  * Resolve an instance of the given seeder class.
  *
  * @param  string  $class
  * @return \Illuminate\Database\Seeder
  */
 protected function resolve($class)
 {
     if (isset($this->container)) {
         $instance = $this->container->make($class);
         return $instance->setContainer($this->container)->setCommand($this->command);
     } else {
         return new $class();
     }
 }
开发者ID:homexxhh,项目名称:iot-rest,代码行数:15,代码来源:Seeder.php

示例15: it_should_auto_inject_dependencies_from_parent_container

 /**
  * @test
  */
 public function it_should_auto_inject_dependencies_from_parent_container()
 {
     $this->parent->singleton(Helper::class, function () {
         return new Helper(uniqid());
     });
     /** @var Service $service */
     $service = $this->local->make(Service::class);
     $this->assertInstanceOf(Service::class, $service);
     $this->assertEquals($this->parent->make(Helper::class)->key, $service->helper->key);
 }
开发者ID:e1stuff,项目名称:layered-laravel-container,代码行数:13,代码来源:LayeredContainerTest.php


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