TopicDetailTransformer.php 468 B

1234567891011121314151617181920212223242526
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Administrator
  5. * Date: 2019/6/17
  6. * Time: 18:10
  7. */
  8. namespace App\Transformers\Topic;
  9. use App\Models\Topic;
  10. use Carbon\Carbon;
  11. use League\Fractal\TransformerAbstract;
  12. class TopicDetailTransformer extends TransformerAbstract
  13. {
  14. public function __construct($uid)
  15. {
  16. $this->uid = $uid;
  17. }
  18. public function transform(Topic $topic)
  19. {
  20. return [
  21. 'id' => $topic['id'],
  22. ];
  23. }
  24. }