Reputation: 69
I tried a solved questions from this site, but for me nothing worked.
This is the code
Items::where('item_id', $item->id)->where('created_at', \Carbon\Carbon::today()->toDateString())->update(['item_price' => $price]);
Items::where('item_id', $item->id)->where('created_at', \Carbon\Carbon::today())->update(['item_price' => $price]);
Is there something I missed?
Upvotes: 2
Views: 113
Reputation: 1061
For Laravel 5.6+, you can simply do something like:
Items::where('item_id', $item->id)->where('created_at', \Carbon\Carbon::today())->update(['item_price' => $price]);
or
Items::where('item_id', $item->id)->where('created_at', Carbon::today())->update(['item_price' => $price]);
Upvotes: 0
Reputation: 69
@TimLewis answered
use ->whereDate() if you use ->toTimeString(), or ->where() with a Carbon variable
Upvotes: 1