/** * Show the application welcome screen to the user. * * @return Response */ public function getIndex() { $featuredProjects = Project::where('active', '1')->where('live', '1')->where('status', '3')->orderBy('id', 'desc')->take(3)->get(); $recentlyAddedProjects = Project::where('active', '1')->where('live', '1')->orderBy('created_at', 'desc')->take(3)->get(); $sliderImgs = Banner::where('active', '1')->orderBy('created_at', 'desc')->get(); return view('welcome', ['_featuredProducts' => $featuredProjects, '_recently_added' => $recentlyAddedProjects, '_menus' => $this->menuItems, '_sliders' => $sliderImgs, 'login_url' => $this->login_url]); }
public function __construct(Request $request, Banner $banners) { if (Auth::user() && Auth::user()->profile->city_id != null) { $model = Banner::where('paid', '1')->where('paid_up', '>=', new \DateTime('today'))->where('city_id', '=', Auth::user()->profile->city_id)->get(); $blockIndex = 0; $bannerIndex = 0; foreach ($model as $one) { if ($blockIndex == self::BLOCK_COUNT) { $bannerIndex++; $blockIndex = 0; } $this->blocks[$blockIndex++][$bannerIndex] = $one; } } else { $model = Banner::where('paid', '1')->where('paid_up', '>=', new \DateTime('today'))->get(); $blockIndex = 0; $bannerIndex = 0; foreach ($model as $one) { if ($blockIndex == self::BLOCK_COUNT) { $bannerIndex++; $blockIndex = 0; } $this->blocks[$blockIndex++][$bannerIndex] = $one; } } }
/** * Display a listing of the resource. * * @return Response */ public function __construct() { $setting = Models\Setting::first(); $this->data['menu'] = Models\Menu::with('child')->where('level', 0)->get(); $this->data['berita'] = Models\Berita::orderBy('id_berita', 'desc')->limit(6)->get(); $this->data['pengumuman'] = Models\Pengumuman::orderBy('tanggal', 'desc')->limit(10)->get(); $this->data['agenda'] = Models\Agenda::orderBy('tgl_posting', 'desc')->limit(5)->get(); $this->data['polling'] = Models\Polling::with('jawaban')->where('status', 'Y')->limit(1)->first(); $this->data['title'] = $setting->title_web; $this->data['desc'] = $setting->desc_web; $this->data['key'] = $setting->key_web; $this->data['logo'] = $setting->logo; $this->data['header_img'] = $setting->bg_header; $this->data['icon'] = $setting->favicon; $this->data['facebook'] = $setting->facebook; $this->data['peta_latitude'] = $setting->peta_latitude; $this->data['peta_longitude'] = $setting->peta_longitude; $this->data['twitter'] = $setting->twitter; $this->data['gplus'] = $setting->gplus; $this->data['slider_home'] = Models\Berita::orderBy('tanggal', 'desc')->limit(5)->get(); $this->data['galeri_home'] = Models\Foto::OrderBy('id_foto', 'desc')->paginate(9); $this->data['opini_home'] = Models\Berita::where('kategori_berita', 5)->orderBy('id_berita', 'desc')->limit(6)->get(); $this->data['banner'] = Models\Banner::where('id', 1)->first(); $this->data['link'] = Models\Link::orderBy('id', 'desc')->limit(5)->get(); $this->data['publikasi'] = Models\Publikasi::orderBy('id', 'desc')->limit(3)->get(); $this->data['setting'] = $setting; }
/** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { //if(!parent::authorize()) return false; if ($this->banner) { if ($this->user()->isAdmin()) { return true; } return Banner::where('id', $this->banner)->where('user_id', $this->user()->id)->exists(); } return true; }
/** * Display the home page. * * @return Response */ public function index() { $url = config('medias.image-host'); $film_url = config('medias.film-host'); //hien thi film hot, sap xep moi nhat len tren $filmCondition = ['publish' => 1, 'isHot' => 1]; $films = $this->film->where($filmCondition)->orderBy('created_at', 'desc')->get(); //$banners = $this->getBanner(); $cond = ['publish' => 1, 'sub_cat_id' => 5]; $banners = Banner::where($cond)->get(); return view('front.index', compact('films', 'url', 'film_url', 'banners')); }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { $banner = Banner::find(1); $cekinputgbr = Input::file('file'); if (!empty($cekinputgbr)) { $oldfile = Banner::where('id', 1)->first(); File::delete('upload/banner/' . $oldfile->gambar); $thefile = Input::file('file'); $lokasi_simpan = 'upload/banner'; $filename = str_random(30) . '.' . $thefile->getClientOriginalExtension(); $upload_gambar = Input::file('file')->move($lokasi_simpan, $filename); $banner->gambar = $filename; } $banner->url = Input::get('url_banner'); $banner->aktif = Input::get('status'); if ($banner->save()) { return redirect()->to('admin/banner')->with('alert', 'Data berhasil di simpan'); } }
/** * Show the application welcome screen to the user. * * @return Response */ public function getIndex() { $menuItems = Menu::where('active', '1')->orderBy('weight', 'asc')->get(); return view('welcome', ['_featuredProducts' => count($this->Projectlist(Null, 'popular')) > 0 ? (object) $this->Projectlist(Null, 'popular') : $this->Projectlist(Null, 'popular'), '_recently_added' => count($this->Projectlist(Null, 'latest')) > 0 ? (object) $this->Projectlist(Null, 'latest') : $this->Projectlist(Null, 'latest'), '_menus' => $menuItems, 'login_url' => $this->login_url, '_categoryLists' => Category::where('active', '1')->orderBy('id', 'asc')->get(), '_genreLists' => Genre::where('active', '1')->orderBy('id', 'asc')->get(), '_projectLists' => count($this->Projectlist()) > 0 ? (object) $this->Projectlist() : $this->Projectlist(), '_sliders' => Banner::where('active', '1')->orderBy('weight', 'asc')->get()]); }
/** * Hien thi danh sach phim bo * Phim bo la nhung phim co so tap > 1 * @param Illuminate\Contracts\Auth\Guard $auth * @param string $slug * @return Response */ public function single() { $img_url = config('medias.image-host'); $film_url = config('medias.film-host'); //return "hello"; $films_most_view = $this->film_gestion->single(); $films = $this->film_gestion->filmBySubCatSlug('tinh-cam'); $links = $films->appends([]); $cond = ['publish' => 1, 'sub_cat_id' => 6]; $banners = Banner::where($cond)->get(); $links->setPath('')->render(); return view('front.film.list', compact('img_url', 'film_url', 'links', 'films_most_view', 'films', 'banners')); }