I
I
Ivan2020-08-19 10:06:16
Laravel
Ivan, 2020-08-19 10:06:16

There are methods similar to firstOrcreate, updateOrCreate but to update the record or not (details inside)?

Good afternoon. The task is something like this. A certain slug comes to the method, we look in the table if there is an entry with such a value. If there is, add the user_id (we get via auth()->user()->id) of the user, if this user_id is not there. If there is already some user_id in this entry found by slug, we do not touch anything. Is there a ready-made method for this, or do I need to come up with something of my own? If not, what is the best way to do it?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question