26 lines
458 B
PHP
26 lines
458 B
PHP
|
<?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,
|
||
|
];
|
||
|
}
|
||
|
|
||
|
}
|