/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { if (\Auth::guest()) { $blog = \App\Blog::where('status', 'publish')->latest()->paginate(5); $photo = \App\Photo::get(); } else { return redirect('/'); $blog = \App\Blog::latest()->paginate(5); $photo = \App\Photo::get(); } return view('blog.list', compact('blog'))->with('photo', $photo); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $photos = Photo::get(); $category = Category::lists('title', 'id')->toArray(); return view('photo/photo', ['photos' => $photos, 'category' => $category]); }