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")