暂存
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Http\Resources\Json;
|
||||
|
||||
class AnonymousResourceCollection extends ResourceCollection
|
||||
{
|
||||
/**
|
||||
* The name of the resource being collected.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $collects;
|
||||
|
||||
/**
|
||||
* Indicates if the collection keys should be preserved.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $preserveKeys = false;
|
||||
|
||||
/**
|
||||
* Create a new anonymous resource collection.
|
||||
*
|
||||
* @param mixed $resource
|
||||
* @param string $collects
|
||||
*/
|
||||
public function __construct($resource, $collects)
|
||||
{
|
||||
$this->collects = $collects;
|
||||
|
||||
parent::__construct($resource);
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the collection keys should be preserved.
|
||||
*/
|
||||
public function preserveKeys(bool $value = true): static
|
||||
{
|
||||
$this->preserveKeys = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user