/** * Treat this method as a controller action. * Return view() or other content to display. */ public function run(Post $post) { $posts = $post->get()->all(); return view("widgets.recent_news", compact('posts')); }
public function index(PostModel $post, UserModel $user) { $posts = $post->orderBy('updated_at', 'desc')->take(5)->get(); $users = $user->whereNotNull('last_login_at')->orderBy('last_login_at', 'desc')->take(5)->get(); return view('backend.dashboard', compact('posts', 'users')); }