我在db上创建了“文章”,其字段为“created_at”=“2018-02-11 01:22:03”。我怎样才能获得当天的链接?
$articles = Article::where('status', 1)->take(5)->get();
return view("site.view", compact("articles"));
答案 0 :(得分:2)
$articles = Article::whereDate('created_at', today())->where('status', 1)->take(5)->get();