public function getIndex() { $posts = Post::orderBy('created_at', 'desc')->paginate(20); return view('redminportal::posts/view')->with('posts', $posts); }
public function getIndex() { $models = Post::orderBy($this->sortBy, $this->orderBy)->paginate($this->perpage); $data = ['models' => $models, 'sortBy' => $this->sortBy, 'orderBy' => $this->orderBy]; return view('redminportal::posts/view', $data); }