laravel-learn-bbs/app/Transformers/CategoryTransformer.php

26 lines
458 B
PHP
Raw Permalink Normal View History

2018-06-10 10:04:03 +00:00
<?php
/**
* Created by PhpStorm.
* User: xing
* Date: 2018/6/10
* Time: 17:31
*/
namespace App\Transformers;
use App\Models\Category;
use League\Fractal\TransformerAbstract;
class CategoryTransformer extends TransformerAbstract
{
public function transform(Category $category)
{
return [
'id' => $category->id,
'name' => $category->name,
'description' => $category->description,
];
}
}