當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。