mirror of
https://github.com/anikeen-com/id.git
synced 2026-03-13 21:56:14 +00:00
Compare commits
1 Commits
1.0.0-alph
...
1.0.0-alph
| Author | SHA1 | Date | |
|---|---|---|---|
|
5b2b3c72cc
|
@@ -4,8 +4,9 @@ namespace Anikeen\Id\Resources;
|
||||
|
||||
use Anikeen\Id\Concerns\MagicProperties;
|
||||
use Anikeen\Id\Result;
|
||||
use JsonSerializable;
|
||||
|
||||
abstract class BaseResource
|
||||
abstract class BaseResource implements JsonSerializable
|
||||
{
|
||||
use MagicProperties;
|
||||
|
||||
@@ -13,4 +14,20 @@ abstract class BaseResource
|
||||
{
|
||||
$this->setMagicProperties($this->result->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the collection of resources as an array.
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
return (array)$this->result->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the collection of resources as a JSON string.
|
||||
*/
|
||||
public function jsonSerialize(): array
|
||||
{
|
||||
return $this->toArray();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user