/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $result1 = DB::table('parent_menu')->get(); $siteTitle = Setting::where('name', 'title')->get(); if (count($siteTitle) > 0) { $bah = $siteTitle->first()->value; } else { $bah = 'Website'; } $datanyah = ParentFrontpage::orderBy('position')->get(); // Atur Grid Menu $h = Setting::where('name', 'grid_height')->get(); if (count($h) > 0) { $h = $h->first()->value; } else { $h = 3; } $w = Setting::where('name', 'grid_width')->get(); if (count($w) > 0) { $w = $w->first()->value; } else { $w = 3; } $bg = Setting::where('name', 'background')->get(); if (count($bg) > 0) { $bg = asset('/uploads/background/') . '/' . $bg->first()->value; } else { $bg = 'assets/img/bg.jpg'; } $footer = Setting::where('name', 'footer')->get(); if (count($footer) > 0) { $footer = $footer->first()->value; } else { $footer = '(c) 2015, Ordent, All Right Reserved.'; } return view('frontend.index', compact('result1', 'bah', 'datanyah', 'h', 'w', 'bg', 'footer')); }
public function index() { if (Auth::check() != 1) { Auth::attempt(['email' => '*****@*****.**', 'password' => 'guestguest']); } $result1 = DB::table('parent_menu')->get(); $siteTitle = Setting::where('name', 'title')->get(); if (count($siteTitle) > 0) { $bah = $siteTitle->first()->value; } else { $bah = 'Website'; } $datanyah = ParentFrontpage::orderBy('position')->get(); // Atur Grid Menu $h = Setting::where('name', 'grid_height')->get(); if (count($h) > 0) { $h = $h->first()->value; } else { $h = 3; } $w = Setting::where('name', 'grid_width')->get(); if (count($w) > 0) { $w = $w->first()->value; } else { $w = 3; } $bg = Setting::where('name', 'background')->get(); if (count($bg) > 0) { $bg = asset('/uploads/background/') . '/' . $bg->first()->value; } else { $bg = 'assets/img/bg.jpg'; } $logo = Setting::where('name', 'logo')->get(); if (count($logo) > 0) { $logo = asset('/uploads/logo/') . '/' . $logo->first()->value; $logo = preg_replace('/\\s+/', '', $logo); } else { $logo = '#'; } $footer = Setting::where('name', 'footer')->get(); if (count($footer) > 0) { $footer = $footer->first()->value; } else { $footer = '(c) 2015, Ordent, All Right Reserved.'; } if (Auth::check()) { $roles = Auth::user()->roles->first(); $resultPermission = $roles->perms; } else { $resultPermission = array(); } //ParentFrontpage::find($permissions->action) //DB::table('parent_frontpage')->where('id', $permissions->action)->orderBy('position', 'asc')->get() $datanyah = array(); foreach ($resultPermission as $permissions) { if ($permissions->type == 'app') { //echo count(ParentFrontpage::find($permissions->action)); if (count(ParentFrontpage::find($permissions->action)) > 0) { array_push($datanyah, ParentFrontpage::find($permissions->action)); } } } $datanyah = $this->array_msort($datanyah, array('position' => SORT_ASC)); return view('frontend.index', compact('result1', 'bah', 'datanyah', 'h', 'w', 'bg', 'footer', 'resultPermission', 'logo')); }