本文整理汇总了PHP中Illuminate\Container\Container::build方法的典型用法代码示例。如果您正苦于以下问题:PHP Container::build方法的具体用法?PHP Container::build怎么用?PHP Container::build使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Container\Container
的用法示例。
在下文中一共展示了Container::build方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build
public function build($concrete, array $parameters = [])
{
if (is_string($concrete) && in_array($concrete, array_keys($this->servicesAliasBridge))) {
return $this->servicesAliasBridge[$concrete];
}
return parent::build($concrete, $parameters);
}
示例2: createFormRequest
/**
* Creates and initializes an Form Request instance.
*
* @param string $class
* @return FormRequest
*/
protected function createFormRequest($class)
{
/*
* @var $formRequest \Illuminate\Foundation\Http\FormRequest
* @var $request Request
*/
list($class, $params) = $this->parseFormRequestName($class);
$request = $this->app->__get('request');
$formRequest = $this->app->build($class, $params);
if ($session = $request->getSession()) {
$formRequest->setSession($session);
}
$formRequest->setUserResolver($request->getUserResolver());
$formRequest->setRouteResolver($request->getRouteResolver());
$formRequest->setContainer($this->app);
return $formRequest;
}
示例3: build
/**
* Instantiate a concrete instance of the given type.
*
* @param string $concrete
* @param array $parameters
* @return mixed
*
* @throws BindingResolutionException
*/
public function build($concrete, $parameters = array())
{
$object = parent::build($concrete, $parameters);
if (is_object($object) && $object instanceof ApplicationAwareInterface) {
$object->setApplication($this);
}
return $object;
}
示例4: resolveHandler
/**
* resolve single log handler via illuminate DI container
*
* @param string $handlerClassName
* @param array $constructorArgs
* @return HandlerInterface
* @throws \Exception
*/
protected function resolveHandler($handlerClassName, array $constructorArgs = [])
{
$handlerClassName = '\\Monolog\\Handler\\' . $handlerClassName;
return $this->container->build($handlerClassName, $constructorArgs);
}