/** * Show the application dashboard. * * @return Response */ public function index() { try { $isInstalled = Setting::where('name', 'is_installed')->firstOrFail(); } catch (ModelNotFoundException $e) { $isInstalled = Setting::create(['name' => 'is_installed', 'setting' => 'no']); } if ($isInstalled->setting != 'yes') { return Redirect::route('install'); } $data = ["event" => Event::first(), "upcomingEvents" => Event::take(3)->get(), "news" => News::take(6)->get(), "media" => Media::where('processed', true)->orderBy('id', 'DESC')->take(12)->get()]; return view('home')->with($data); }
public function showall() { $items = Items::orderBy('created_at', 'desc')->get(); $categories = DB::table('categories')->get(); foreach ($items as $item) { $r = DB::table('sub_categories')->select('categories_id')->where('id', $item->sub_categories_id)->get(); $item['category'] = $r[0]->categories_id; } $news = News::take(3)->get(); return view('index', ['categories' => $categories, 'items' => $items, 'news' => $news]); }