示例#1
0
 public function index()
 {
     $videoCount = Video::count();
     $memberCount = $this->userRepo->countMembers();
     $eventCount = Event::count();
     return view('admin.index', ['noOfVideos' => $videoCount, 'noOfMembers' => $memberCount, 'noOfEvents' => $eventCount]);
 }
 public function videoPass(Swf2VidEvent $event)
 {
     /** @var Video $video */
     if ($data = $event->getEventData()) {
         if ($video = @Video::find($data['video']['video_id'])) {
             if ($user = $event->getUser()) {
                 if (Video::count(['conditions' => ['project_id = ? and vid_status = "pass" and updated_at > DATE_SUB(NOW(), INTERVAL 10 MINUTE)', $video->project_id]])) {
                     //redo
                     return;
                 }
                 $minLevel = Swf2Vid::getInstance()->getUserVideoLevel();
                 $levels = $user->user_level;
                 /** @var UserLevel $level */
                 foreach ($levels as $level) {
                     if ($level->credits > 0) {
                         if (AccessLevels::getInstance()->checkAccess($level->level, $minLevel)) {
                             $level->credits = $level->credits - 1;
                             $level->save_direct();
                             return;
                         }
                     }
                 }
             }
             $video->vid_status = 'fail';
             $video->save_direct();
         }
         App::getInstance()->dispatch(Swf2VidEvent::VIDEO_NO_CREDITS, $event);
     }
 }