VideoController.php 890 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace App\Http\Controllers;
  3. use Illuminate\Http\Request;
  4. use App\Services\LiquidRenderer;
  5. class VideoController extends Controller
  6. {
  7. protected $liquidRenderer;
  8. public function __construct(LiquidRenderer $liquidRenderer)
  9. {
  10. $this->liquidRenderer = $liquidRenderer;
  11. }
  12. /**
  13. * Display a listing of the videos.
  14. *
  15. * @return \Illuminate\Http\Response
  16. */
  17. public function index()
  18. {
  19. $videos = Video::paginate(10); // 每页显示10个视频
  20. return $this->liquidRenderer->render('videos.index', ['videos' => $videos]);
  21. }
  22. /**
  23. * Display the specified video.
  24. *
  25. * @param int $id
  26. * @return \Illuminate\Http\Response
  27. */
  28. public function show($id)
  29. {
  30. $video = Video::findOrFail($id);
  31. return $this->liquidRenderer->render('videos.show', ['video' => $video]);
  32. }
  33. }