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


PHP Container::call方法代码示例

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


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

示例1: handle

 /**
  * Handle the filter.
  *
  * @param Builder              $query
  * @param FieldFilterInterface $filter
  * @param TableBuilder         $builder
  */
 public function handle(Builder $query, FieldFilterInterface $filter, TableBuilder $builder)
 {
     $stream = $filter->getStream();
     $fieldType = $stream->getFieldType($filter->getField());
     $fieldTypeQuery = $fieldType->getQuery();
     $this->container->call([$fieldTypeQuery, 'filter'], compact('query', 'filter', 'builder'));
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:14,代码来源:FieldFilterQuery.php

示例2: evaluate

 /**
  * Evaluate a target entity with arguments.
  *
  * @param        $target
  * @param  array $arguments
  * @return mixed
  */
 public function evaluate($target, array $arguments = [])
 {
     /**
      * If the target is an instance of Closure then
      * call through the IoC it with the arguments.
      */
     if ($target instanceof \Closure) {
         return $this->container->call($target, $arguments);
     }
     /**
      * If the target is an array then evaluate
      * each of it's values.
      */
     if (is_array($target)) {
         foreach ($target as &$value) {
             $value = $this->evaluate($value, $arguments);
         }
     }
     /**
      * if the target is a string and is in a traversable
      * format then traverse the target using the arguments.
      */
     if (is_string($target) && !isset($arguments[$target]) && $this->isTraversable($target)) {
         $target = data_get($arguments, $target, $target);
     }
     return $target;
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:34,代码来源:Evaluator.php

示例3: handle

 /**
  * Handle the view query.
  *
  * @param  TableBuilder  $builder
  * @param  Builder       $query
  * @param  ViewInterface $view
  * @return mixed
  * @throws \Exception
  */
 public function handle(TableBuilder $builder, Builder $query, ViewInterface $view)
 {
     $view->fire('querying', compact('builder', 'query'));
     if (!($handler = $view->getQuery())) {
         return;
     }
     // Self handling implies @handle
     if (is_string($handler) && !str_contains($handler, '@')) {
         $handler .= '@handle';
     }
     /*
      * If the handler is a callable string or Closure
      * then call it using the IoC container.
      */
     if (is_string($handler) || $handler instanceof \Closure) {
         $this->container->call($handler, compact('builder', 'query'));
     }
     /*
      * If the handle is an instance of ViewQueryInterface
      * simply call the handle method on it.
      */
     if ($handler instanceof ViewQueryInterface) {
         $handler->handle($builder, $query);
     }
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:34,代码来源:ViewQuery.php

示例4: handle

 /**
  * Handle the filter.
  *
  * @param Builder               $query
  * @param SearchFilterInterface $filter
  */
 public function handle(Builder $query, TableBuilder $builder, SearchFilterInterface $filter)
 {
     $stream = $filter->getStream();
     $model = $builder->getTableModel();
     /**
      * If the model is translatable then
      * join it's translations so they
      * are filterable too.
      *
      * @var EloquentQueryBuilder $query
      */
     if ($model->getTranslationModelName() && !$query->hasJoin($model->getTranslationTableName())) {
         $query->leftJoin($model->getTranslationTableName(), $model->getTableName() . '.id', '=', $model->getTranslationTableName() . '.' . $model->getRelationKey());
     }
     $query->where(function (Builder $query) use($filter, $stream) {
         foreach ($filter->getColumns() as $column) {
             $query->orWhere($column, 'LIKE', "%{$filter->getValue()}%");
         }
         foreach ($filter->getFields() as $field) {
             $filter->setField($field);
             $fieldType = $stream->getFieldType($field);
             $fieldTypeQuery = $fieldType->getQuery();
             $fieldTypeQuery->setConstraint('or');
             $this->container->call([$fieldTypeQuery, 'filter'], compact('query', 'filter', 'builder'));
         }
     });
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:33,代码来源:SearchFilterQuery.php

示例5: filterValue

 /**
  * Filter value.
  *
  * @param  mixed   $value
  * @param  string  $filter
  *
  * @return mixed
  */
 protected function filterValue($value, $filter)
 {
     $resolver = $this->getFilterResolver($filter);
     if (method_exists($resolver[0], $resolver[1])) {
         return $this->app->call($resolver, ['value' => $value]);
     }
     return $value;
 }
开发者ID:andrehol,项目名称:parser-1,代码行数:16,代码来源:Document.php

示例6: 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:dkulyk,项目名称:json-rpc,代码行数:13,代码来源:ParamsValidator.php

示例7: callIfExistsAndEnabled

 /**
  * Call and resolve depepndencies of a method if enabled.
  *
  * @author	Andrea Marco Sartori
  * @param	string	$method
  * @param	array	$parameters
  * @return	void
  */
 private function callIfExistsAndEnabled($method, array $parameters = [])
 {
     if (!$this->isEnabled()) {
         return;
     }
     if (method_exists($this, $method) && $this->{"{$method}IsEnabled"}()) {
         $this->container->call([$this, $method], $parameters);
     }
 }
开发者ID:ChristianGiupponi,项目名称:Auth,代码行数:17,代码来源:AbstractPipe.php

示例8: resolve

 /**
  * Resolve the target.
  *
  * @param        $target
  * @param array  $arguments
  * @param array  $options
  * @return mixed
  */
 public function resolve($target, array $arguments = [], array $options = [])
 {
     $method = array_get($options, 'method', 'handle');
     if (is_string($target) && str_contains($target, '@') || is_callable($target)) {
         $target = $this->container->call($target, $arguments);
     } elseif (is_string($target) && class_exists($target) && class_implements($target, SelfHandling::class)) {
         $target = $this->container->call($target . '@' . $method, $arguments);
     }
     return $target;
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:18,代码来源:Resolver.php

示例9: registerValidators

 /**
  * Register field's custom validators.
  *
  * @param Factory     $factory
  * @param FormBuilder $builder
  * @param FieldType   $fieldType
  */
 protected function registerValidators(Factory $factory, FormBuilder $builder, FieldType $fieldType)
 {
     foreach ($fieldType->getValidators() as $rule => $validator) {
         $handler = array_get($validator, 'handler');
         if (is_string($handler) && !str_contains($handler, '@')) {
             $handler .= '@handle';
         }
         $factory->extend($rule, function ($attribute, $value, $parameters, Validator $validator) use($handler, $builder) {
             return $this->container->call($handler, compact('attribute', 'value', 'parameters', 'builder', 'validator'));
         }, array_get($validator, 'message'));
     }
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:19,代码来源:FormExtender.php

示例10: dispatchNow

 /**
  * Dispatch a command to its appropriate handler in the current process.
  *
  * @param  mixed  $command
  * @param  mixed  $handler
  * @return mixed
  */
 public function dispatchNow($command, $handler = null)
 {
     if ($handler || ($handler = $this->getCommandHandler($command))) {
         $callback = function ($command) use($handler) {
             return $handler->handle($command);
         };
     } else {
         $callback = function ($command) {
             return $this->container->call([$command, 'handle']);
         };
     }
     return $this->pipeline->send($command)->through($this->pipes)->then($callback);
 }
开发者ID:davidhemphill,项目名称:framework,代码行数:20,代码来源:Dispatcher.php

示例11: make

 /**
  * Make a route.
  *
  * @param                    $route
  * @param  array             $parameters
  * @return mixed|null|string
  */
 public function make($route, array $parameters = [])
 {
     if (method_exists($this, $method = $this->str->camel(str_replace('.', '_', $route)))) {
         $parameters['parameters'] = $parameters;
         return $this->container->call([$this, $method], $parameters);
     }
     if (!str_contains($route, '.') && ($stream = $this->entry->getStreamSlug())) {
         $route = "{$stream}.{$route}";
     }
     if (!str_contains($route, '::') && ($namespace = $this->locator->locate($this->entry))) {
         $route = "{$namespace}::{$route}";
     }
     return $this->url->make($route, $this->entry, $parameters);
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:21,代码来源:EntryRouter.php

示例12: run

 /**
  * Run a macro.
  *
  * @param       $macro
  * @param Image $image
  * @return Image
  * @throws \Exception
  */
 public function run($macro, Image $image)
 {
     if (!($process = array_get($this->getMacros(), $macro))) {
         return $image;
     }
     if (is_array($process)) {
         foreach ($process as $method => $arguments) {
             $image->addAlteration($method, $arguments);
         }
     }
     if ($process instanceof \Closure) {
         $this->container->call($process, compact('image', 'macro'));
     }
     return $image;
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:23,代码来源:ImageMacros.php

示例13: __construct

 /**
  * Create a new Grid instance.
  *
  * @param  \Illuminate\Contracts\Container\Container  $app
  */
 public function __construct(Container $app)
 {
     $this->app = $app;
     if (method_exists($this, 'initiate')) {
         $app->call([$this, 'initiate']);
     }
 }
开发者ID:stevebauman,项目名称:html,代码行数:12,代码来源:Grid.php

示例14: passesAuthorization

 /**
  * Determine if the request passes the authorization check.
  *
  * @return bool
  */
 protected function passesAuthorization()
 {
     if (method_exists($this, 'authorize')) {
         return $this->container->call([$this, 'authorize']);
     }
     return false;
 }
开发者ID:azraai,项目名称:foundation,代码行数:12,代码来源:MenuHandler.php

示例15: passesAuthorization

 /**
  * Determine if the request passes the authorization check.
  *
  * @return bool
  */
 protected function passesAuthorization()
 {
     $enabled = false;
     if (method_exists($this, 'authorize')) {
         $enabled = $this->container->call([$this, 'authorize']);
     }
     return (bool) $enabled;
 }
开发者ID:quetzyg,项目名称:foundation,代码行数:13,代码来源:MenuHandler.php


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