mardi 14 février 2017

How to use Eloquent fluent syntax to update records after joining?

I am trying to use fluent syntax with eloquent to achieve the same results as the below SQL query would achieve.

UPDATE t
SET t.completed = t.completed + 1
FROM  [groups] AS g
INNER JOIN [quotas] AS t ON t.qid = g.qid
WHERE g.iid = 12234

The groups table has a model called group. Also, the quotas table has a model called quota

What is the correct way to join the two model and increment the quota.completed property?

Note, each model point to a different database.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2lNFFxa
via IFTTT

Aucun commentaire:

Enregistrer un commentaire