12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?php
- namespace App\Http\Controllers;
- use Illuminate\Http\Request;
- use App\Services\LiquidRenderer;
- use App\Models\DistVideo ;
- class VideoController extends Controller
- {
- protected $liquidRenderer;
- public function __construct(LiquidRenderer $liquidRenderer)
- {
- $this->liquidRenderer = $liquidRenderer;
- }
- /**
- * Display a listing of the videos.
- *
- * @return \Illuminate\Http\Response
- */
- public function index()
- {
- $videos = DistVideo::paginate(10)->where('dist_id', getDistId()); // 每页显示10个视频
- return $this->liquidRenderer->render('videos.index', ['videos' => $videos]);
- }
- /**
- * Display the specified video.
- *
- * @param int $id
- * @return \Illuminate\Http\Response
- */
- public function show($id)
- {
- $video = DistVideo::findOrFail($id);
- // 构建导航数据 开始
- $breadcrumbs = [
- [
- 'url' => '/',
- 'name' => 'Home',
- ]
- ];
- $category=$video->distVideoCategory;
- $breadcrumbs[] = [
- 'url' => "/videos/{$category->name}",
- 'name' => $category->name,
- ];
- $breadcrumbs[] = [
- 'url' => '#',
- 'name' => $video->title,
- ];
- return $this->liquidRenderer->render('videos.show', ['video' => $video, 'breadcrumbs' => $breadcrumbs]);
- }
- }
|