gpt4 book ai didi

php - 如何知道更新了哪些字段

转载 作者:行者123 更新时间:2023-12-05 08:17:28 26 4
gpt4 key购买 nike

我在 laravel 5 工作,我有一个模块,用户可以在其中更新学生的信息,为此,用户有一个预加载的表格,其中包含当前数据,他可以修改他想要的字段。然后,在我做的 Controller :

$perfil->update(Input::all())

效果还不错。所以我的问题是:有没有办法获取已更新字段的名称?

最佳答案

即使在坚持之后,您也可以在 Eloquent 模型上使用 getChanges()

$offer->update($data);
$offer->getChanges(); // [ "price_min" => "1233", "updated_at" => "2019-01-10 15:36:23"]

关于php - 如何知道更新了哪些字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34028319/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com