123456789101112131415161718192021222324252627282930313233 |
- <?php
- namespace App\Repositories\Transformers\Exam;
- use Carbon\Carbon;
- use League\Fractal\TransformerAbstract;
- use App\Repositories\Models\Exam\Paper;
- /**
- * Class PaperTransformer.
- *
- * @package namespace App\Repositories\Transformers\Exam;
- */
- class PaperTransformer extends TransformerAbstract
- {
- /**
- * Transform the Paper entity.
- *
- * @param \App\Repositories\Models\Exam\Paper $model
- *
- * @return array
- */
- public function transform(Paper $model)
- {
- return [
- 'id' => (int)$model->id,
- 'name' => $model->name,
- 'topics' => $model->topics,
- 'created_at' => $model->created_at->format(Carbon::DEFAULT_TO_STRING_FORMAT),
- 'updated_at' => $model->updated_at->format(Carbon::DEFAULT_TO_STRING_FORMAT)
- ];
- }
- }
|