MessageTransformer.php 653 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace App\Transformers;
  3. use League\Fractal\TransformerAbstract;
  4. use App\Models\Message;
  5. /**
  6. * Class MessageTransformer.
  7. *
  8. * @package namespace App\Transformers;
  9. */
  10. class MessageTransformer extends TransformerAbstract
  11. {
  12. /**
  13. * Transform the Message entity.
  14. *
  15. * @param \App\Models\Message $model
  16. *
  17. * @return array
  18. */
  19. public function transform(Message $model)
  20. {
  21. return [
  22. 'id' => (int) $model->id,
  23. /* place your other model properties here */
  24. 'created_at' => $model->created_at,
  25. 'updated_at' => $model->updated_at
  26. ];
  27. }
  28. }