1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- /*
- * This file is part of the Jiannei/lumen-api-starter.
- *
- * (c) Jiannei <longjian.huang@foxmail.com>
- *
- * This source file is subject to the MIT license that is bundled
- * with this source code in the file LICENSE.
- */
- namespace App\Repositories\Transformers;
- use App\Models\Resource;
- use League\Fractal\TransformerAbstract;
- class ResourceTransformer extends TransformerAbstract
- {
- public function transform(Resource $resource)
- {
- $data = [
- 'id' => $resource->id,
- 'title' => $resource->title,
- 'cover' => $resource->cover,
- 'video' => $resource->video,
- 'view_num' => $resource->view_num,
- 'status' => $resource->status,
- 'created_at' => $resource->created_at,
- 'updated_at' => $resource->updated_at,
- ];
- return $data;
- }
- }
|