CollaborationComment
3 weeks ago
Collection
3 weeks ago
CollectionItem
3 weeks ago
Media
3 weeks ago
PageContentResource.php
3 days ago
PageResource.php
3 days ago
PageSettingsResource.php
3 weeks ago
SymbolResource.php
3 weeks ago
SymbolResource.php
32 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Kirki\App\Resources; |
| 4 | |
| 5 | use Kirki\App\DTO\Symbol\SymbolDTO; |
| 6 | use Kirki\App\Supports\Facades\Symbol; |
| 7 | use Kirki\Framework\Resource; |
| 8 | |
| 9 | class SymbolResource extends Resource |
| 10 | { |
| 11 | public function __construct(SymbolDTO $symbol) |
| 12 | { |
| 13 | parent::__construct($symbol); |
| 14 | } |
| 15 | |
| 16 | /** |
| 17 | * Convert the collection resource to an array. |
| 18 | * |
| 19 | * @return array The collection data as an associative array. |
| 20 | */ |
| 21 | public function to_array() |
| 22 | { |
| 23 | return [ |
| 24 | 'id' => (int) $this->id, |
| 25 | 'symbolData' => $this->symbolData ?? [], |
| 26 | 'type' => $this->type ?? 'other', |
| 27 | 'setAs' => $this->setAs ?? '', |
| 28 | 'preview' => Symbol::get_preview_html($this->resource, [], false), |
| 29 | ]; |
| 30 | } |
| 31 | } |
| 32 |