public function index() { $data['users'] = DB::table('blog')->simplePaginate(2); //good practice for paginate // $data['users']=Blog::Paginate(2); $data['categories'] = Category::all(); return view('all_post', $data); }
public function index() { $data['user'] = Blog::all(); $data['categories'] = Category::all(); return view('all_post', $data); }
public function search_post(Request $request) { if ($request->isMethod('post')) { $search = $request->search; $data['user'] = Blog::where('title', 'like', "%{$search}%")->orWhere('description', 'like', "%{$search}%")->get(); $data['categories'] = Category::all(); return view('all_post', $data); } }
/** * Display a listing of the resource. * * @return Response */ public function getIndex() { return view("admin.blog.categories.list")->with("categories", Category::all()); }