コード例 #1
0
ファイル: ImportController.php プロジェクト: skafetzo/SPtool
 public function import()
 {
     set_time_limit(0);
     DB::table('videos')->delete();
     //
     //if (file_exists('video1.xml')) {
     $uri = 'http://a1.noterik.com:8081/smithers2/domain/espace/user/luce/video';
     //dd($uri);
     $content = utf8_encode(file_get_contents($uri));
     $xml = simplexml_load_string($content);
     //print_r($xml);
     foreach ($xml->video as $video) {
         //echo '--video_id='.$xml->video['id'].PHP_EOL;
         //echo '--genre='.$video->properties->genre.PHP_EOL;
         $video_item = new Video();
         $video_item->video_id = $video['id'];
         $video_item->genre = $video->properties->genre;
         $video_item->topic = $video->properties->topic;
         $video_item->title = $video->properties->TitleSet_TitleSetInEnglish_title;
         $video_item->geographical_coverage = $video->properties->SpatioTemporalInformation_SpatialInformation_GeographicalCoverage;
         $video_item->summary = $video->properties->summaryInEnglish;
         $video_item->thesaurus_terms = $video->properties->ThesaurusTerm;
         $video_item->save();
     }
     //
     return view('video.parser');
 }
コード例 #2
0
 public function newVideo($link)
 {
     $video = new Video();
     $video->user = Auth::user()->name;
     $video->link = $link;
     $video->save();
 }
コード例 #3
0
 public function topEnrichment(Request $request)
 {
     try {
         $users = MecanexUser::all();
         $videos = Video::all();
         $euscreen_id = $request->video;
         $video_id = $videos->where('video_id', $euscreen_id)->first()->id;
         $username = $request->user;
         $user_id = $users->where('username', $username)->first()->id;
         if ($request->num != 0) {
             $num = $request->num;
         } else {
             $num = 3;
         }
         $topEnrichments = [];
         $listEnrichments = DB::select(DB::raw('SELECT * FROM enrichments_videos_time WHERE video_id=?'), [$video_id]);
         $listEnrichments = json_decode(json_encode($listEnrichments), true);
         $topEnrichments = $this->recommend_enr($listEnrichments, $user_id);
         $topEnrichments = array_slice($topEnrichments, 0, $num, true);
         foreach ($topEnrichments as $key => $score) {
             $response[] = array('enrichment_id' => Enrichment::find($key)->enrichment_id, 'score' => $score);
         }
         $statusCode = 200;
         return $response;
     } catch (Exception $e) {
         $statusCode = 400;
     } finally {
         return Response::json($response, $statusCode);
     }
 }
コード例 #4
0
 public function run()
 {
     $faker = Faker::create();
     foreach (range(0, 30) as $index) {
         Video::create(['title' => $faker->sentence(1), 'image_url' => $faker->imageUrl(600, 600), 'url' => 'https://s3-us-west-2.amazonaws.com/mytrainr/getenkampe/videos/converted/start_mathijs_2.mp4', 'description' => $faker->sentence(10)]);
     }
 }
コード例 #5
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($type, $id)
 {
     if ($id == 'video') {
         $events = Video::all();
         return view('video.show', compact('events'));
     } elseif ($id == 'staff') {
         $events = Staff::all();
         return view('staff.show', compact('events'));
     } elseif ($id == 'gallery') {
         $events = Image::all();
         return view('gallery.show', compact('events'));
     } else {
         $event = Event::where('slug', $id)->where('type', $type)->first();
         $location = Location::where('event_id', $event->id)->first();
         $slider = EventImage::where('event_id', $event->id)->orderBy(\DB::raw('RAND()'))->take(4)->get();
         $gallery = EventImage::where('event_id', $event->id)->first();
         if ($event->type == $type) {
             if ($event->status == 1) {
                 return view($type . '.show', compact('event', 'location', 'slider', 'gallery'));
             } else {
                 return redirect('/' . $type . '/');
             }
         }
     }
 }
コード例 #6
0
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     $u = User::create(['first_name' => 'test', 'last_name' => 'test', 'email' => '*****@*****.**', 'level' => 1]);
     $u2 = User::create(['first_name' => 'test2', 'last_name' => 'test2', 'email' => '*****@*****.**', 'level' => 1]);
     $u3 = User::create(['first_name' => 'test3', 'last_name' => 'test3', 'email' => '*****@*****.**', 'level' => 2]);
     $e1 = Event::create(['name' => 'test event', 'user_id' => 3, 'slug' => 'test-event-1', 'date' => '2016-10-17', 'start' => '18:00:00', 'end' => '5:00:00']);
     $e2 = Event::create(['name' => 'test event', 'user_id' => 1, 'slug' => 'test-event-2', 'date' => '2016-08-22', 'start' => '19:00:00', 'end' => '5:00:00']);
     Event::create(['name' => 'test event', 'user_id' => 2, 'slug' => 'test-event-3', 'date' => '2017-01-07', 'start' => '18:00:00', 'end' => '5:00:00']);
     $p1 = Playlist::create(['name' => 'Playlist principale !']);
     $p2 = Playlist::create(['name' => 'The Playlist !']);
     $p3 = Playlist::create(['name' => 'Playlist secondaire']);
     Playlist::create(['name' => 'The Playlist !']);
     $p1->styles()->sync([1, 2, 3]);
     $p2->styles()->sync([1, 4]);
     $p3->styles()->sync([1, 3, 5, 7]);
     $e1->playlists()->sync([1, 3]);
     $e2->playlists()->sync([2]);
     Comment::create(['event_id' => 2, 'user_id' => 2, 'content' => 'Sooo goooood']);
     Comment::create(['event_id' => 3, 'user_id' => 2, 'content' => 'Sooo goooood :D']);
     Comment::create(['event_id' => 2, 'user_id' => 3, 'content' => 'Sooo goooood !!!']);
     Video::create(['url' => '7l48bfQuJeE', 'artist' => 'Chill Bump', 'name' => 'Lost In The Sound', 'tags' => 'chill bump lost in the sound']);
     Video::create(['url' => 'XxdPJvhQaMU', 'artist' => 'Chill Bump', 'name' => 'Water boycotter', 'tags' => 'chill bump water boycotter']);
     Video::create(['url' => 'kWXAYDQ_K7k', 'artist' => 'Chill Bump', 'name' => 'The Memo', 'tags' => 'chill bump the memo']);
     $pivot1 = $p1->videos()->sync([1, 3]);
     $pivot2 = $p2->videos()->sync([2]);
     $pivot3 = $p3->videos()->sync([1, 2, 3]);
     News::create(['title' => 'news test', 'content' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. ', 'user_id' => 2, 'slug' => 'text-news-1']);
     News::create(['title' => 'news test 2', 'content' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. ', 'user_id' => 3, 'slug' => 'text-news-2']);
     Article::create(['title' => 'Article test 1', 'content' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. ', 'user_id' => 2, 'slug' => 'text-article-1']);
     Article::create(['title' => 'Article test 2', 'content' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. ', 'user_id' => 3, 'slug' => 'text-article-2', 'event_id' => 2]);
 }
コード例 #7
0
 /**
  * @param VideoFormRequest $request
  * @param Video $video
  * @return \Illuminate\Http\RedirectResponse
  */
 public function store(Request $request, Video $video)
 {
     //retrieve the authenticated user
     if ($request->ajax()) {
         $user = Auth::user();
         //create the resource
         $video->title = $request->get('title');
         $video->url = $request->get('videoUrl');
         $video->description = $request->get('description');
         $video->category_id = $request->get('videoCategory');
         $video->user_id = $user->id;
         $video->save();
         return response(json_encode($request->all()));
     }
     return redirect()->action('HomeController@index');
 }
コード例 #8
0
ファイル: PageController.php プロジェクト: goyuquan/album
 public function homepage()
 {
     $album_latsed = Album::where('published_at', '<', date("Y-m-d h:i:s"))->where('display_id', 0)->orderBy('id', 'desc')->take(8)->get();
     $Video_latsed = Video::where('published_at', '<', date("Y-m-d h:i:s"))->orderBy('id', 'desc')->take(8)->get();
     $banner = Album::where('display_id', 2)->get();
     return view('welcome', ['album_latsed' => $album_latsed, 'video_latsed' => $Video_latsed, 'banners' => $banner]);
 }
コード例 #9
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $video = Video::find(1);
     for ($i = 1; $i <= 3; $i++) {
         $data = ['user_id' => User::find($i)->id, 'video_id' => $video->id, 'comment' => 'Lorem ipsum comment'];
         Comment::create($data);
     }
 }
コード例 #10
0
 public function submitHandler(Request $request)
 {
     $statuses = implode(',', (new Video())->statuses);
     $sources = implode(',', (new Video())->sources);
     $this->validate($request, ['title' => 'required|string|between:2,255', 'slug' => 'required|string|between:2,255|unique:videos,slug', 'description' => 'string|min:2', 'url' => 'required|url', 'source_id' => 'required|string', 'thumbnail' => 'required|url', 'status' => "required|in:{$statuses}", 'source' => "required|in:{$sources}"]);
     $video = Video::create($request->only('title', 'slug', 'description', 'url', 'thumbnail', 'status', 'source', 'source_id'));
     return redirect(route('home'))->with('global_flash', 'Video added!');
 }
コード例 #11
0
 /**
  * Handle the event.
  *
  * @param  UserWasDeleted  $event
  * @return void
  */
 public function handle(UserWasDeleted $event)
 {
     // Delete everything the user created
     Article::where('user_id', $event->user_id)->delete();
     Photo::where('user_id', $event->user_id)->delete();
     PhotoAlbum::where('user_id', $event->user_id)->delete();
     Video::where('user_id', $event->user_id)->delete();
     VideoAlbum::where('user_id', $event->user_id)->delete();
 }
コード例 #12
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(CreateVideoRequest $request)
 {
     $video = Video::create(['project_id' => $request->input('project_id'), 'youtube_id' => $request->input('youtube_id')]);
     if ($video) {
         flash()->success('Video added successfully.');
     } else {
         flash()->error('Oops! Something went wrong.');
     }
     return redirect(route('backend'));
 }
コード例 #13
0
 public function run()
 {
     DB::table('videos')->truncate();
     Model::unguard();
     Video::create(['youtube_id' => 'fdhSrchAzrk']);
     Video::create(['youtube_id' => '4nROcTVrQyY']);
     Video::create(['youtube_id' => 'hpfAr6y_CYw']);
     Video::create(['youtube_id' => 'FcfjyG4Dis4']);
     Video::create(['youtube_id' => 'dElW3KVPjtA']);
     Model::reguard();
 }
コード例 #14
0
 /**
  * Delete a video.
  *
  * @param $slug
  * @return mixed
  */
 public function delete($slug)
 {
     $slug = explode('-', $slug);
     $id = $slug[0];
     $video = $this->video->find($id);
     if ($video->count() > 0) {
         $video->delete();
         return redirect('dashboard/videos')->withSuccess('Video removed');
     }
     abort(404);
 }
コード例 #15
0
 /**
  * Watch a video fully.
  *
  * @param $slug
  * @return mixed
  */
 public function watchVideo($slug)
 {
     $slug = explode('-', $slug);
     $id = $slug[0];
     $video = $this->video->find($id);
     if ($video->count() > 0) {
         $this->userVideo->create(['user_id' => \Auth::user()->id, 'video_id' => $id]);
         return redirect()->back()->withSuccess('Video watched');
     }
     abort(404);
 }
コード例 #16
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $video = Video::find(1);
     $type = ['like', 'dislike'];
     for ($i = 0; $i < 100; $i++) {
         $user = $this->createUser();
         $key = array_rand($type);
         $data = ['user_id' => $user->id, 'video_id' => $video->id, 'type' => $type[$key]];
         LikeDislike::create($data);
     }
 }
コード例 #17
0
ファイル: AdminController.php プロジェクト: izzach/Capstone
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //
     $videos = Video::orderBy('views', 'desc')->limit(5)->get();
     $totalViews = Video::all()->sum('views');
     $comments = Video::orderBy('numComments', 'desc')->limit(5)->get();
     $totalComments = Video::all()->sum('numComments');
     $tracker = Tracker::all()->where('date', Carbon::today()->format('m/d/Y'));
     $totalTrackers = Tracker::all()->where('date', Carbon::today()->format('m/d/Y'))->count();
     return view('admin.stats', compact('videos', 'totalViews', 'comments', 'totalComments', 'tracker', 'totalTrackers'));
 }
コード例 #18
0
 public function index()
 {
     $title = "Dashboard";
     $news = News::count();
     $newscategory = NewsCategory::count();
     $users = User::count();
     $photo = Photo::count();
     $photoalbum = PhotoAlbum::count();
     $video = Video::count();
     $videoalbum = VideoAlbum::count();
     return view('admin.dashboard.index', compact('title', 'news', 'newscategory', 'video', 'videoalbum', 'photo', 'photoalbum', 'users'));
 }
コード例 #19
0
ファイル: LikeController.php プロジェクト: izzach/Capstone
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(LikeRequest $request)
 {
     $input = $request->all();
     if (Auth::guest()) {
         \Session::flash('flash_message', 'You need to be logged in to like/dislike!');
     } else {
         $input['user_id'] = Auth::id();
         Like::create($input);
     }
     $video = Video::findOrFail($input['video_id']);
     return view('videos/show', compact('video'));
 }
コード例 #20
0
ファイル: TumblrUser.php プロジェクト: roslairy/tumfetch
 /**
  * 得到页面上所有的视频地址,已经存过的视频地址不会被重新储存。
  * @param int $page 第几页
  * @return array 视频地址
  */
 protected function fetchVideosrcs($page)
 {
     // 准备DOM
     $html = $this->getHtml($page);
     $dom = new Dom();
     $dom->load($html);
     $videoSrcs = [];
     // 遍历全部iframe
     foreach ($dom->find('iframe') as $videoFrame) {
         // 获得iframe的地址
         $videoFrameSrc = $videoFrame->getAttribute('src');
         // 如果iframe的地址不存在,或者不含有特定字符串(用来判别是否是视频),废弃
         if (empty($videoFrameSrc)) {
             continue;
         }
         if (!strstr($videoFrameSrc, 'https://www.tumblr.com/video/')) {
             continue;
         }
         // 如果已经检测了此视频,返回
         $parentId = $videoFrame->getParent()->getAttribute('id');
         $name = explode('_', $parentId)[3] . '.mp4';
         if (Video::where('name', '=', $name)->count() != 0) {
             continue;
         }
         // 准备video的DOM
         $videoHtml = $this->requestHtml($videoFrameSrc);
         $videoDom = new Dom();
         $videoDom->load($videoHtml);
         // 获取对应节点
         $videoElem = $videoDom->find('video')[0];
         $videoSource = $videoElem->find('source')[0];
         // 开始读取数据
         $video = new Video();
         $video->state = 'detected';
         $video->error = '';
         $video->name = $name;
         $video->source = $videoSource->getAttribute('src');
         $video->save();
     }
 }
コード例 #21
0
ファイル: CommentController.php プロジェクト: izzach/Capstone
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(CommentRequest $request)
 {
     $input = $request->all();
     if (Auth::guest()) {
         \Session::flash('flash_message', 'You need to be logged in to comment!');
     } else {
         $input['user_id'] = Auth::id();
         Comment::create($input);
     }
     $video = Video::findOrFail($input['video_id']);
     $test = Video::where('id', $input['video_id'])->increment('numComments');
     return view('videos/show', compact('video', 'test'));
 }
コード例 #22
0
ファイル: VideosController.php プロジェクト: jgt/ceprog
 public function delete($id, Request $request)
 {
     $video = Video::find($id);
     $public_path = public_path();
     $file = $public_path . '/uploads/' . $video->original_filename;
     if ($file) {
         Archivo::delete($file);
         $video->delete();
     }
     if ($request->ajax()) {
         return response()->json($video);
     }
 }
コード例 #23
0
ファイル: VideoController.php プロジェクト: goyuquan/album
 public function destroy($id)
 {
     $video = Video::findOrFail($id);
     if (Gate::denies('video_authorize', $video)) {
         return "authorize fails";
     }
     File::delete('videos/' . $video->video);
     File::delete('uploads/thumbnails/' . $video->thumbnail);
     File::delete('uploads/' . $video->thumbnail);
     File::delete('uploads/thumbnails/' . $video->thumbnail2);
     File::delete('uploads/' . $video->thumbnail2);
     Video::destroy($id);
     return redirect('/admin/videos/');
 }
コード例 #24
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::statement('SET FOREIGN_KEY_CHECKS=0;');
     Video::truncate();
     $this->call(VideosTableSeeder::class);
     User::truncate();
     $this->call(UsersTableSeeder::class);
     Analyse::truncate();
     $this->call(AnalyseTableSeeder::class);
     Group::truncate();
     $this->call(GroupsTableSeeder::class);
     Sport::truncate();
     $this->call(SportsTableSeeder::class);
     DB::statement('SET FOREIGN_KEY_CHECKS=1;');
 }
コード例 #25
0
ファイル: VideoController.php プロジェクト: anrito/video
 public function renderVideoByCategory($id)
 {
     $videos = \App\Video::where('is_publish', '1')->orderBy('id', 'desc');
     $ids = array();
     $categories = \DB::select('select * from video_categories where categories_id = ?', array($id));
     foreach ($categories as $value) {
         $ids[] = $value->video_id;
     }
     $videos = $videos->whereIn('id', $ids)->get()->toArray();
     // Render View With Parameters
     return \View::make('video.bycategory')->with('videos', $videos);
     // print "<pre>";
     // var_dump(  );
     // exit;
 }
コード例 #26
0
 /**
  * @return Video|best
  */
 public function best()
 {
     $videos = Video::all();
     $best_vidos = [];
     $id_best_videos = [];
     foreach ($videos as $video) {
         $id_best_videos[] = [$video->likes()->count(), $video->id];
     }
     arsort($id_best_videos);
     $id_best_videos = array_slice($id_best_videos, 0, 10);
     foreach ($id_best_videos as $value) {
         $best_vidos[] = Video::find($value[1]);
     }
     return $best_vidos;
 }
コード例 #27
0
ファイル: UpdateDB.php プロジェクト: noorxbyte/vultex
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $url = "http://omdbapi.com/?i=";
     // get all the videos with an IMDB ID
     $videos = Video::whereNotNull('imdb')->get();
     echo "\nUpdating....\n\n";
     // loop through all the videos
     foreach ($videos as $video) {
         // get JSON data
         $json = file_get_contents($url . $video->imdb);
         $obj = json_decode($json);
         // update fields of the video with JSON data
         $video->product->name = $obj->Title;
         $video->poster = '/img/posters/' . $video->imdb . '.jpg';
         $video->release_year = $obj->Year;
         if ($obj->Released !== 'N/A') {
             $video->release_date = new \DateTime($obj->Released);
         }
         // download the poster
         if (!file_exists('/img/posters/' . $video->imdb . '.jpg') && filter_var($obj->Poster, FILTER_VALIDATE_URL) !== false) {
             $buffer = file_get_contents($obj->Poster);
             $file = fopen(public_path() . '/img/posters/' . $video->imdb . '.jpg', 'w+');
             fwrite($file, $buffer);
             fclose($file);
         }
         // save the video
         $video->save();
         // delete the products gnere
         DB::table('genre_product')->where('product_id', $video->product_id)->delete();
         // get the genres
         $genres = explode(',', $obj->Genre);
         foreach ($genres as $key => $genre) {
             $genres[$key] = trim($genre);
         }
         // add the genres
         foreach ($genres as $genre) {
             // if genre does not exist create it
             $record = Genre::where('name', $genre)->first();
             if ($record === null) {
                 $record = Genre::create(['name' => $genre]);
             }
             // attatch genre to video
             $video->product->genres()->attach([$record->id]);
         }
         // log to screen
         echo $video->product_id . ". \t" . $video->product->name . " updated successfully.\n";
     }
 }
コード例 #28
0
 public static function downloadVideo()
 {
     $videos = Video::where('state', '=', 'detected')->take(1)->get();
     if ($videos->count() == 0) {
         return;
     }
     $video = $videos[0];
     $sys = php_uname('s');
     if ($sys == 'Windows NT') {
         TumblrDownloader::downloadVideoInWindowsNT($video);
     } else {
         if ($sys == 'Linux') {
             TumblrDownloader::downloadVideoInLinux($video);
         }
     }
 }
コード例 #29
0
ファイル: TumblrZip.php プロジェクト: roslairy/tumfetch
 public static function zipOneDay(Carbon $date)
 {
     $begin = $date->copy()->setTime(0, 0, 0);
     $end = $date->copy()->setTime(23, 59, 59);
     $deleteLocs = [];
     $videoLocs = [];
     $videos = Video::where('state', '=', 'downloaded')->where('updated_at', '>=', $begin->toDateTimeString())->where('updated_at', '<=', $end->toDateTimeString())->get();
     foreach ($videos as $video) {
         $deleteLocs[] = $video->location;
         $videoLocs[] = storage_path('app/' . $video->location);
         $video->state = 'zipped';
         $video->save();
     }
     $imageLocs = [];
     $images = Image::where('state', '=', 'downloaded')->where('updated_at', '>=', $begin->toDateTimeString())->where('updated_at', '<=', $end->toDateTimeString())->get();
     foreach ($images as $image) {
         $deleteLocs[] = $image->location;
         $imageLocs[] = storage_path('app/' . $image->location);
         $image->state = 'zipped';
         $image->save();
     }
     $locs = array_merge($videoLocs, $imageLocs);
     if (count($locs) == 0) {
         Log::info('TumblrZip : no file to be ziped.');
         return;
     }
     $zipName = $begin->toDateString() . '.zip';
     $zipLocs = 'zips/' . $zipName;
     $zippy = Zippy::load();
     $zippy->create(storage_path('app/' . $zipLocs), $locs);
     $zip = new Zip();
     $zip->state = 'ziped';
     $zip->error = '';
     $zip->name = $zipName;
     $zip->date = $begin->toDateString();
     $zip->size = number_format(Storage::size($zipLocs) / 1024.0 / 1024.0, 2) . 'MB';
     $zip->imageSize = count($imageLocs);
     $zip->videoSize = count($videoLocs);
     $zip->location = $zipLocs;
     $zip->save();
     Storage::delete($deleteLocs);
 }
コード例 #30
0
 public function menuList(Request $request)
 {
     // $classes = Video::distinct()->groupBy('class')->get();
     // //$topicsList = Video::distinct()->groupBy('topic')->get();
     // //$topicsList = Topic::distinct()->groupBy('course')->orderBy('priority','ASC')->get();
     // $topicsList = Video::join('topics',function($join){
     // 	$join->on('videos.topic','=','topics.topic')->On('videos.class','=','topics.course');
     // })->groupBy('topics.topic')->orderBy('priority', 'ASC')->get();
     // $menuList = Video::get();
     // $videos = Video::where('instructor','like', $squery)->orWhere('title', 'like', $squery)->orWhere('class', 'like', $squery)->orderBy('id', 'DESC')->paginate(15);
     // $data = Video::join('topics',function($join){
     // 	$join->on('videos.class','=','topics.course') ->on('videos.unit','=','topics.unit');
     // })->groupBy('topics.course')->orderBy('priority', 'ASC')->get();
     $data = Video::orderBy('order', 'ASC')->get();
     $classes = Video::distinct()->groupBy('class')->get();
     $menuList = Topic::orderBy('priority', 'ASC')->get();
     return view('videos.menu', compact('menuList', 'classes', 'data'));
     //return view('videos.menu', compact('videos'))->with('search', $search);
     //return view('videos.menu');
 }