ShopTransformer.php 985 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace App\Repositories\Transformers\Base;
  3. use App\Repositories\Models\Base\Shop;
  4. use Carbon\Carbon;
  5. use League\Fractal\TransformerAbstract;
  6. /**
  7. * Class ShopTransformer.
  8. *
  9. * @package namespace App\Repositories\Transformers\Base;
  10. */
  11. class ShopTransformer extends TransformerAbstract
  12. {
  13. /**
  14. * Transform the Role entity.
  15. *
  16. * @param \App\Repositories\Models\Base\Shop $model
  17. *
  18. * @return array
  19. */
  20. public function transform(Shop $model)
  21. {
  22. return [
  23. 'id' => (int)$model->id,
  24. 'name' => $model->name,
  25. 'show_title' => $model->show_title,
  26. 'sign' => $model->sign,
  27. 'end_time' => $model->end_time,
  28. 'point' => $model->point,
  29. 'status' => $model->status,
  30. 'created_at' => $model->created_at->format(Carbon::DEFAULT_TO_STRING_FORMAT),
  31. 'updated_at' => $model->updated_at->format(Carbon::DEFAULT_TO_STRING_FORMAT)
  32. ];
  33. }
  34. }