【发布时间】:2020-02-19 11:06:04
【问题描述】:
一切都在 dd 中正确显示,但在 table 中没有任何变化。有谁知道为什么?
$name = $request->get('name');
$now= new DateTime;
$userId = Auth::id();
dd($name . $userId); //tady je to ještě OK
DB::table('users')->where('id', $userId)->where('changed_name', '<', Carbon::now()->subdays(60)->toDateTimeString())->update(['name' => $name, 'changed_name' => $now]);
return redirect('/profile');
【问题讨论】:
-
您将
changed_name与Carbon::now()->subdays(60)->toDateTimeString()进行比较,我认为应该是$name。您的观点可能会有所不同。 -
@DilipHirapara 可能
changed_name是他们改名的日期。 -
changed_name 是时间戳,您应该每 60 天只能更改一次名称
标签: php sql database laravel controller