本文整理匯總了PHP中Illuminate\Database\Eloquent\Collection::all方法的典型用法代碼示例。如果您正苦於以下問題:PHP Collection::all方法的具體用法?PHP Collection::all怎麽用?PHP Collection::all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Illuminate\Database\Eloquent\Collection
的用法示例。
在下文中一共展示了Collection::all方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: fireEvents
/**
* Fire an event for each of response
*/
protected function fireEvents()
{
array_map(function (VkRequest $request, $response) {
$status = isset($response['error_code']) ? VkRequest::STATUS_FAIL : VkRequest::STATUS_SUCCESS;
$event = sprintf(VkRequest::EVENT_FORMAT, $status, $request->method, $request->tag);
event($event, [$request, $response]);
}, $this->requests->all(), $this->responses);
}
示例2: summarizeDocuments
/**
* Prepares the list of given resources for json response
*
* @param Collection $documents
* @return array
*/
protected function summarizeDocuments(Collection $documents)
{
return array_map(function ($document) {
return $document->summarize();
}, $documents->all());
}
示例3: get
public function get()
{
return $this->data->all();
}
示例4: testAddingItemsToCollection
public function testAddingItemsToCollection()
{
$c = new Collection(array('foo'));
$c->add('bar');
$this->assertEquals(array('foo', 'bar'), $c->all());
}
示例5: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update(Project $project, Sprint $sprint, Collection $stories)
{
$sprint->stories()->saveMany($stories->all());
return response()->json(['status' => 'success', 'message' => 'Stories added to sprint.', 'stories' => $stories]);
}