CommentRecordTransformer.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace App\Transformers\Behavior;
  3. /**
  4. * Created by PhpStorm.
  5. * User: durong
  6. * Date: 2019/6/14
  7. * Time: 下午18:34
  8. */
  9. use App\Models\CommentRecord;
  10. use League\Fractal\TransformerAbstract;
  11. class CommentRecordTransformer extends TransformerAbstract
  12. {
  13. public function transform(CommentRecord $commentList)
  14. {
  15. return [
  16. 'id' => $commentList['id'],
  17. 'created_at' => date($commentList['created_at']),
  18. 'virus_behavior_id' => $commentList['virus_behavior_id'],
  19. 'uid' => $commentList['uid'],
  20. 'upper_trigger_time' => $commentList['upper_trigger_time'],
  21. 'related_content_id' => $commentList['related_content_id'],
  22. 'content_author_id' => $commentList['content_author_id'],
  23. 'superior_commentator_id' => $commentList['superior_commentator_id'],
  24. 'physical_exertion' => $commentList['physical_exertion'],
  25. 'trigger_type' => $commentList['trigger_type'],
  26. 'generation_type' => $commentList['generation_type'],
  27. 'release_status' => $commentList['release_status'],
  28. 'generation_quantity' => $commentList['generation_quantity'],
  29. 'quantity_issued' => $commentList['quantity_issued'],
  30. 'current_comment_id' => $commentList['current_comment_id'],
  31. 'superior_comment_id' => $commentList['superior_comment_id'],
  32. 'behavior_cycle_type' => $commentList->Behavior->behavior_cycle_type,
  33. 'name' => $commentList->Behavior->name,
  34. 'relative_series' => $commentList->Behavior->relative_series,
  35. 'is_open' => $commentList->Behavior->is_open,
  36. 'bahavior_created_at' => date($commentList->Behavior->created_at),
  37. ];
  38. }
  39. }