CommentController.php 860 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace App\Http\Controllers\Client;
  3. use App\Http\Controllers\Controller;
  4. use App\Services\Client\CommentService;
  5. use Illuminate\Http\Request;
  6. class CommentController extends Controller
  7. {
  8. protected CommentService $service;
  9. public function __construct(CommentService $service)
  10. {
  11. $this->service = $service;
  12. }
  13. /**
  14. * 发表评价
  15. */
  16. public function create(Request $request)
  17. {
  18. $coachId = $request->input('coach_id');
  19. $content = $request->input('content');
  20. $rating = $request->input('rating');
  21. return $this->service->createComment($coachId, $content, $rating);
  22. }
  23. /**
  24. * 评价列表
  25. */
  26. public function list(Request $request)
  27. {
  28. $coachId = $request->input('coach_id');
  29. return $this->service->getCommentList($coachId);
  30. }
  31. }