我正在尝试使用 Laravel 5 和碳展示一篇每日文章。我已将published_at 字符串转换为碳对象,这样我就可以得到比较的日子。我只是无法弄清楚where子句会是什么。
//this is in my model to make it a carbon object
protected $dates = ['published_at'];
//method in my controller
public function current()
{
$article = Article::where('published_at', '>=', Carbon::now())->first();
//testing prints 2 but today is the 1st
dd($article->published_at->day);
return view('articles.show')->with('article', $article);
}