當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Collection::collapse方法代碼示例

本文整理匯總了PHP中Illuminate\Support\Collection::collapse方法的典型用法代碼示例。如果您正苦於以下問題:PHP Collection::collapse方法的具體用法?PHP Collection::collapse怎麽用?PHP Collection::collapse使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Support\Collection的用法示例。


在下文中一共展示了Collection::collapse方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: rowsUngrouped

 public function rowsUngrouped()
 {
     if (!isset($this->rows)) {
         $this->rows = $this->rows();
     }
     return $this->rows instanceof GroupedCollection ? new Collection($this->rows->collapse()) : $this->rows;
 }
開發者ID:portonefive,項目名稱:tabulator,代碼行數:7,代碼來源:TableBuilder.php

示例2: call

 /**
  * @param $resource
  * @param array $arguments
  * @param string $method
  * @return string
  * @throws Exception
  */
 private function call($resource, $arguments, $method)
 {
     try {
         $request = $this->client->{$method}($this->endpoint . $resource, ['headers' => ['Authorization' => 'apikey ' . $this->apikey, 'Content-type' => 'application/json'], 'body' => json_encode($arguments)]);
         $collection = new Collection($request->json());
         if ($collection->count() == 1) {
             return $collection->collapse();
         }
         return $collection;
     } catch (RequestException $e) {
         throw new Exception($e->getResponse()->getBody());
     }
 }
開發者ID:rodrigobendia,項目名稱:mailchimp-api-v3,代碼行數:20,代碼來源:Mailchimp.php

示例3: makeRequest

 /**
  * @param string $resource
  * @param array $arguments
  * @param string $method
  * @return string
  * @throws Exception
  */
 private function makeRequest($resource, $arguments, $method)
 {
     try {
         $options = $this->getOptions($method, $arguments);
         $response = $this->client->{$method}($this->endpoint . $resource, $options);
         $collection = new Collection(json_decode($response->getBody(), true));
         if ($collection->count() == 1) {
             return $collection->collapse();
         }
         return $collection;
     } catch (ClientException $e) {
         throw new Exception($e->getResponse()->getBody());
     } catch (RequestException $e) {
         $response = $e->getResponse();
         if ($response instanceof ResponseInterface) {
             throw new Exception($e->getResponse()->getBody());
         }
         throw new Exception($e->getMessage());
     }
 }
開發者ID:guiwoda,項目名稱:laravel-mailchimp-v3,代碼行數:27,代碼來源:Mailchimp.php

示例4: testCollapseWithNestedCollactions

 public function testCollapseWithNestedCollactions()
 {
     $data = new Collection([new Collection([1, 2, 3]), new Collection([4, 5, 6])]);
     $this->assertEquals([1, 2, 3, 4, 5, 6], $data->collapse()->all());
 }
開發者ID:sa7bi,項目名稱:euro16,代碼行數:5,代碼來源:SupportCollectionTest.php


注:本文中的Illuminate\Support\Collection::collapse方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。