I have a table "app_sessions" in my database with a composite unique key on device_id and device_token. I want to insert a new session in this table only if the record with device_id or device_token doesn't exist, otherwise just update the session for this record.
We can do this with a "insert .... on duplicate key update ....." query. But how can we achieve this using laravel 5.0 eloquent.
Note: We all know the other ways to do it, like fetching the record first and then inserting or updating depending on the results.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/28RSuop
via IFTTT
Aucun commentaire:
Enregistrer un commentaire