YanjingGuo
YanjingGuo
可以了,在场景中重新定义规则。
 这么写的,为了最后获取最新数据还要 find 一下
我以为更新后返回的是最新更新完成后的所有内容呢。而且这里应该是程序处理了吧,创建时间与更新时间返回的是格式化后的日期,删除时间返回的是时间戳,如何统一返回时间戳或格式化后的字符串?  
> append不支持这样做,需要多个,就直接写在一个数组里 可以在模型里设置直接默认输出吗?
> 不支持,可以自己封装一个类似的东西,利用模型事件(查询后)。 每次查询后都会调用。 > > 这个东西我用了很多,对于关联操作,尽量不要调用,影响性能。 对于格式化处理这种可以用。 好的,感谢。我看模型有个 filed 属性可以控制写入的字段,以为也有个其他属性控制读取的字段呢。

无法直接更新 delete_time 吗?必须使用 restore() 更新 delete_time ?
> 无法直接更新 delete_time 吗?必须使用 restore() 更新 delete_time ? 使用 force() 强制更新也不行
> 看下我使用的 > > ``` > $data = model::onlyTrashed()->whereIn('id', $ids)->select(); > foreach ($data as $k) { > $k->restore(); > } > ``` 对,就是需要使用 restore 恢复软删除的,使用更新直接更新 delete_time 为 null 好像不管用。