示例#1
0
 /**
  * @param bool $category
  * @return Video
  */
 public function getPrev($category = false)
 {
     if (!$category) {
         return Video::where('id', '<', $this->id)->orderBy('id', 'DESC')->first();
     } else {
         return Video::whereCategoryId($this->category->id)->where('id', '<', $this->id)->orderBy('id', 'DESC')->first();
     }
 }
示例#2
0
 public function byCategory($catId)
 {
     $cat = VideoCategories::find($catId);
     if ($cat) {
         $vids = Video::where('category_id', $catId)->get();
         return view('videos.by-cat')->with('videos', $vids)->with('category', $cat);
     }
     return redirect("/videos");
 }
 public function view($aid, Request $request)
 {
     try {
         $back = RequestUtil::getUrl(BiliBiliHelper::$SERVICE_URL . "/view/{$aid}");
         if ($back['code'] != 200) {
             throw new Exception('视频未找到...');
         }
         $content = $back['content'];
         $count = Video::where('aid', '=', $aid)->count();
         if ($count == 0) {
             $video = ['aid' => intval($aid), 'title' => $content['title'], 'author' => $content['author'], 'description' => $content['description'], 'created' => $content['created'], 'created_at' => $content['created_at'], 'face' => $content['face'], 'typename' => $content['typename'], 'pages' => $content['pages'], 'list' => serialize($content['list'])];
             try {
                 Video::create($video);
             } catch (Exception $ignore) {
             }
         }
         $content['aid'] = $aid;
         return view('play')->with('video', $content);
     } catch (\Exception $e) {
         return $this->returnError($e->getMessage());
     }
 }
示例#4
0
 /**
  * Get the edit form for the transcript of a video
  */
 protected function getAnalysis(Request $request, $id)
 {
     $video = Video::where('id', $id)->firstOrFail();
     $questionaire = $video->questionaire()->get()->first();
     if (!$questionaire->locked) {
         $questionaire->locked = true;
         $questionaire->save();
     }
     if ($video->analysis == "no") {
         $video->analysis = "running";
         $video->save();
     }
     $this->authorize('video-analysis', $questionaire);
     $data = array('video' => $video, 'video_types' => $this->getVideoTypes(), 'questionaire' => $questionaire);
     return view('observation.analysis', $data);
 }
示例#5
0
 public function getSearch(Request $request)
 {
     PHPRedis::incr('count_pages');
     $searchZone = $request->input('search-zone');
     $videos = Video::where('name', 'LIKE', '%' . $searchZone . '%')->where('validated', true)->get();
     $searchZoneWords = explode(' ', $searchZone);
     $videos_by_tag = Video::withAnyTag($searchZoneWords)->get();
     $scripts = ['application'];
     return view('front.overviews')->with(compact('videos', 'searchZone', 'videos_by_tag', 'scripts'));
 }
示例#6
0
 public function getVideosSearch(Request $request)
 {
     $searchZone = $request->input('search-zone');
     $videos = Video::where('name', 'LIKE', '%' . $searchZone . '%')->get();
     return view('dashboards.admin.videos.videos_online')->with(compact('videos', 'searchZone'));
 }