Laravel 模型查询压入字段,怎么自定义?急
protected $appends = ['beMonthYear'];
public function getBeMonthYearAttribute()
{
return betweenMonth($this->at_start, $this->at_end, '-');
}
这是模型里面自定义的,有时我又不需要查出beMonthYear字段,怎么灵活的自定义,现在每次查出来都带上beMonthYear,有没有解决办法?谢谢
推荐文章: