1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- namespace App\Repositories\Transformers\Info;
- use App\Repositories\Models\Info\Information;
- use League\Fractal\TransformerAbstract;
- class InformationTransformer extends TransformerAbstract
- {
- /**
- * Prepare data to present.
- *
- * @param Information $information
- * @return array
- */
- public function transform(Information $information)
- {
- // if (request()->has('id')) {
- // return [
- // 'id' => $information->id,
- // 'created_at' => $information->created_at ? $information->created_at->format('Y-m-d H:i:s') : null,
- // ];
- // }
- return [
- 'id' => $information->id,
- 'type' => $information->type,
- 'title' => $information->title,
- // 'subtitle' => $information->subtitle,
- 'synopsis' => $information->synopsis,
- 'content' => $information->content,
- 'status' => $information->status,
- 'created_at' => $information->created_at ? $information->created_at->format('Y-m-d H:i:s') : null,
- ];
- }
- }
|