l5-repository
l5-repository copied to clipboard
Update with multiple where
Hi there, I have a question very normal for you. How can i get update with another two fields without using id? Thank you for helping.
same problem.. Anyone with an answer?
Same problem.
me too,same problem
https://github.com/andersao/l5-repository/pull/176 the update method can receive an array in its second argument,
this topic is 3 years old, but I didn't want to open a new one. I have just started using this package that is awesome for a lot of stuff.
Anyway, let's say that I have a where array like the following one:
$where = [
'field_one' => 1,
'field_two' => "john"
'field_three' => 1990
];
and I want to set a specific field for entries matching these criteria:
$updates = [
'needs_review' => 1
];
For the "delete" operation is easy: $this->repository->deleteWhere($where);
.
It would be nice to have something like $this->repository->updateWhere($where, $updates);
Let me know if during this time something has changed, or if there is another way to accomplish this task.
Thanks