From b1124432c75ce3e94f0c5dae148ebf13072d9cd0 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Sun, 7 Aug 2022 13:44:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E7=9B=B4=E6=8E=A5=E4=BB=8E?= =?UTF-8?q?=E8=AF=84=E8=AE=BA=E4=B8=AD=E4=B8=80=E9=94=AE=E7=94=9F=E6=88=90?= =?UTF-8?q?=E8=8A=82=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/VideoQueryController.php | 9 ++++++++- resources/views/video/index.blade.php | 11 +++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/VideoQueryController.php b/app/Http/Controllers/VideoQueryController.php index 02d3b99..c840170 100644 --- a/app/Http/Controllers/VideoQueryController.php +++ b/app/Http/Controllers/VideoQueryController.php @@ -10,9 +10,16 @@ class VideoQueryController extends BaseController { public function info(Request $request, Videos $video) { + $pivots = $video->program_pivots; + if (sizeof($pivots) === 0) { + $comment = $video->comments()->where("is_top", "=", 1)->first(); + } else { + $comment = null; + } return view("video.index", [ "video" => $video, - "video_pivots" => $video->program_pivots + "video_pivots" => $pivots, + "comment" => $comment, ]); } } diff --git a/resources/views/video/index.blade.php b/resources/views/video/index.blade.php index 722a874..fd95889 100644 --- a/resources/views/video/index.blade.php +++ b/resources/views/video/index.blade.php @@ -61,6 +61,17 @@ @endforeach +@auth("web") +@if(sizeof($video_pivots) === 0 && $comment) +
+@endif +@endauth @include("common.footer")