// 将published_at 作为Carbon对象来chu l
public $date = ['published_at'];
// setTitleAttribute 设置属性
public function setPublishedAtAttribute($date)
{
$this->attributes['published_at'] = Carbon::createFormFormat('Y-m-d',$date);
}
scopeFunction($query) $query 查询语句
public function scopePublished($query)
{
$query->where('published_at','<=',Carbon::now());
}









网友评论