本文整理匯總了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);
}