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