public function home() { //$videoList = Youtube::getPopularVideos('US'); $objtaxo = new Taxonomy(); $objSetting = new Settings(); $objVideos = new Videos(); $objSlide = (new Slides())->where('status', 1)->get(); $popular = Youtube::getPopularVideos('US'); //get videos by category $taxo = $objtaxo->first(); $objSetting = $objSetting->where('type', '=', 'site_settings')->first(); $setting = json_decode($objSetting->content); return view('frontend::home', array('setting' => $setting, 'ft_videos' => $this->getFeaturedVideos(), 'youtube_cate' => $this->getYoutubeVideos(), 'populars' => $popular, 'slides' => $objSlide)); }
public function slug($name, $table = '') { switch ($table) { case 'taxonomy': $slug = Str::slug($name); $obj = new Taxonomy(); $i = 0; while (1) { if ($i == 0) { $check = $obj->where('alias', '=', $slug)->count(); } else { $check = $obj->where('alias', '=', $slug . '-' . $i)->count(); } if ($check == 0 && $i != 0) { return $slug . '-' . $i; } elseif ($check == 0 && $i == 0) { return $slug; } $i++; } break; case 'post': $slug = Str::slug($name); $obj = new Posts(); $i = 0; while (1) { if ($i == 0) { $check = $obj->where('alias', '=', $slug)->count(); } else { $check = $obj->where('alias', '=', $slug . '-' . $i)->count(); } if ($check == 0 && $i != 0) { return $slug . '-' . $i; } elseif ($check == 0 && $i == 0) { return $slug; } $i++; } break; default: $slug = Str::slug($name); break; } return $slug; }
public static function get_video_cate() { $objTaxo = new Taxonomy(); $taxo = $objTaxo->get(); return $taxo; }
public function taxonomyitem(Request $request, $id) { $limit = 500; $request = $request->all(); $objTaxonomy = new Taxonomy(); $vocabulary = $objTaxonomy->where('id', '=', $id)->first(); $page = isset($request['page']) ? $request['page'] : 1; $order = isset($request['order']) ? $request['order'] : 'asc'; $sort = isset($request['sort']) ? $request['sort'] : ''; $start = $page * $limit - $limit; $objTaxonomyitem = new Taxonomyitem(); $query = $objTaxonomyitem->where('vid', '=', $id); if (isset($request['name'])) { $query = $query->where('name', 'like', '%' . $request['name'] . '%'); } $paging = $objTaxonomyitem->paginate($limit); switch ($sort) { case 'name': $query = $query->orderBy('name', $order); break; } $list = $query->skip($start)->take($limit)->get(); //pr($list);die; $listdatas = array(); foreach ($list as $k => $v) { $tmp['id'] = $v['id']; $tmp['name'] = $v['name']; $tmp['parent'] = $v['parent']; $listdatas[$k] = $tmp; } $html = ''; $tree = array(); $listdatas1 = $listdatas; $listree = $this->listtree($listdatas1, 0, $tree); return view('taxonomy::list_item', array('paging' => $paging, 'vocabulary' => $vocabulary, 'listree' => $listree, 'listdata' => $listree, 'items' => $this->printlist($listdatas, 0, $html), 'start' => $start, 'request' => $request, 'vid' => $id)); }