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


PHP Arr::add方法代码示例

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


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

示例1: add

 /**
  * Append new data
  *
  * @param string $index Unique identifier
  * @param null $data
  * @param bool $toAdmin If show on admin environment
  * @return $this
  */
 public function add($index, $data = null, $toAdmin = false)
 {
     if (!$this->has($index)) {
         $this->data = Arr::add($this->data, $index, $data);
         $this->metas = Arr::add($this->metas, $this->firstIndex($index), ['admin' => $toAdmin]);
     }
     return $this;
 }
开发者ID:bruno-barros,项目名称:wordpress-packages,代码行数:16,代码来源:GlobalJs.php

示例2: getAccessTokenResponse

 /**
  * {@inheritdoc}
  */
 public function getAccessTokenResponse($code)
 {
     $postKey = version_compare(ClientInterface::VERSION, '6') === 1 ? 'form_params' : 'body';
     $response = $this->getHttpClient()->post($this->getTokenUrl(), [$postKey => $this->getTokenFields($code)]);
     $data = [];
     parse_str($response->getBody(), $data);
     return Arr::add($data, 'expires_in', Arr::pull($data, 'expires'));
 }
开发者ID:telenok,项目名称:account,代码行数:11,代码来源:FacebookProvider.php

示例3: addErrorMessage

 /**
  * Add error messages to the current array of error messages
  *
  * @param string $key     Key to store messages against
  * @param array $messages Messages to store
  *
  * @return void
  */
 protected function addErrorMessage($key, $messages)
 {
     $messagesKey = $key . '.errors';
     if ($key == null) {
         $messagesKey = 'errors';
     }
     $this->errorMessages = Arr::add($this->errorMessages, $messagesKey, $messages);
 }
开发者ID:continuous-deployment,项目名称:pipes,代码行数:16,代码来源:PipelineValidator.php

示例4:

 /**
  * Add an element to an array using "dot" notation if it doesn't exist.
  *
  * @param  array $array
  * @param  string $key
  * @param  mixed $value
  * @return array
  */
 function array_add($array, $key, $value)
 {
     return Arr::add($array, $key, $value);
 }
开发者ID:saj696,项目名称:pipe,代码行数:12,代码来源:helpers.php

示例5: addUpdatedAtColumn

 /**
  * Add the "updated at" column to an array of values.
  *
  * @param  array  $values
  * @return array
  */
 protected function addUpdatedAtColumn(array $values)
 {
     if (!$this->model->usesTimestamps()) {
         return $values;
     }
     $column = $this->model->getUpdatedAtColumn();
     return Arr::add($values, $column, $this->model->freshTimestampString());
 }
开发者ID:drickferreira,项目名称:rastreador,代码行数:14,代码来源:Builder.php

示例6: parseConfig

 /**
  * Parse and prepare the database configuration.
  *
  * @param  array   $config
  * @param  string  $name
  * @return array
  */
 protected function parseConfig(array $config, $name)
 {
     return Arr::add(Arr::add($config, 'prefix', ''), 'name', $name);
 }
开发者ID:delatbabel,项目名称:framework,代码行数:11,代码来源:ConnectionFactory.php

示例7: appendOption

 public function appendOption($value, $label)
 {
     $this->options = Arr::add($this->options, $value, $label);
     return $this;
 }
开发者ID:laravolt,项目名称:semantic-form,代码行数:5,代码来源:Select.php

示例8: createAttachRecord

 /**
  * Create a new pivot attachment record.
  *
  * @param  int   $id
  * @param  bool  $timed
  * @return array
  */
 protected function createAttachRecord($id, $timed)
 {
     $record = parent::createAttachRecord($id, $timed);
     return Arr::add($record, $this->morphType, $this->morphClass);
 }
开发者ID:manhvu1212,项目名称:videoplatform,代码行数:12,代码来源:MorphToMany.php

示例9: getResult

 /**
  * Gets results from prepared query
  *
  * @return null
  */
 protected function getResult()
 {
     if ($this->query_type == 'eloquent') {
         $this->result_object = $this->query->get();
         $this->result_array = $this->result_object->toArray();
     } else {
         $this->result_object = $this->query->get();
         $this->result_array = array_map(function ($object) {
             return (array) $object;
         }, $this->result_object);
     }
     if ($this->dataFullSupport) {
         $walk = function ($value, $key, $prefix = null) use(&$walk, &$result_array) {
             $key = !is_null($prefix) ? $prefix . "." . $key : $key;
             if (is_array($value)) {
                 array_walk($value, $walk, $key);
             } else {
                 $result_array = Arr::add($result_array, $key, $value);
             }
         };
         $result_array = array();
         array_walk($this->result_array, $walk);
         $this->result_array = $result_array;
     }
 }
开发者ID:khaidirh,项目名称:laravel4-datatables-package,代码行数:30,代码来源:Datatables.php

示例10: storeExpression

 /**
  * Save the expression
  *
  * @param  string $key
  * @param  mixed $expression
  * @return void
  */
 protected function storeExpression($key, $expression)
 {
     if (A::has($this->expressions, $key)) {
         $this->expressions = A::set($this->expressions, $key, $expression);
     } else {
         $this->expressions = A::add($this->expressions, $key, $expression);
     }
     $this->reload();
 }
开发者ID:elepunk,项目名称:evaluator,代码行数:16,代码来源:Memory.php

示例11: getHttpClient

 /**
  * Prepare configured http client
  *
  * @return GuzzleHttp\Client
  * @author Sebastian
  **/
 protected function getHttpClient($config)
 {
     $guzzleConfig = Arr::get($config, 'guzzle', []);
     return new HttpClient(Arr::add($guzzleConfig, 'connect_timeout', 60));
 }
开发者ID:beryldev,项目名称:laravel-emaillabs,代码行数:11,代码来源:EmailLabsServiceProvider.php

示例12: getTokenFields

 /**
  * Get the POST fields for the token request.
  *
  * @param  string  $code
  * @return array
  */
 protected function getTokenFields($code)
 {
     return Arr::add(parent::getTokenFields($code), 'grant_type', 'authorization_code');
 }
开发者ID:arcanedev,项目名称:socialite,代码行数:10,代码来源:GoogleProvider.php

示例13: addValidationOption

 /**
  * Add validation option.
  *
  * @param string $type
  * @param string $key
  * @param string $value
  *
  * @throws ValidateException
  *
  * @return array
  */
 protected function addValidationOption($type, $key, $value)
 {
     $this->checkValidationTypes($type);
     $this->validationOptions = Arr::add($this->validationOptions, "{$type}.{$key}", $value);
     return $this->validationOptions;
 }
开发者ID:iolson,项目名称:support,代码行数:17,代码来源:ValidateTrait.php


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