本文整理汇总了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]);
}