mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 17:28:55 +00:00
22 lines
482 B
PHP
22 lines
482 B
PHP
<?php
|
|
|
|
namespace App\Transformers;
|
|
|
|
use App\Models\RootCategory;
|
|
use League\Fractal\TransformerAbstract;
|
|
|
|
class CategoryTransformer extends TransformerAbstract
|
|
{
|
|
/**
|
|
* Transform a root category into an array.
|
|
*/
|
|
public function transform(RootCategory $category): array
|
|
{
|
|
return [
|
|
'id' => $category->id,
|
|
'name' => $category->title,
|
|
'subcategories' => $category->categories()->pluck('title', 'id'),
|
|
];
|
|
}
|
|
}
|