Open utterances-bot opened 2 years ago
Hi, I see you are only updating the votes column. How can I update or create multiple records and columns in one query? I have all of the data in the $request->all() and I have multiple records so for example in my name column I have an array of names in $request->name. ['Jack', 'Tom', 'Emily'] How can I do this?
If you want to perform multiple "update or insert" in a single query, then you should use the "upsert()" method instead. If you want to know more about this, you can follow the Laravel official documentation. https://laravel.com/docs/8.x/eloquent#upserts
How to use the updateOrCreate() method in Laravel
In this tutorial, you are going to learn how to use the updateOrCreate()method in Laravel.Let’s think, we have a database table named
https://codesource.io/how-to-use-the-updateorcreate-method-in-laravel/?utterances=04e03c83fb8fb5f7584cb6d0mFVjuM%2BCzlTwkwvPV3GCkNFvXJ1fr0nia1eXsqWwIg%2BkWtX1xMLgju8niemPWVt0xk41vD0ePBsS2XsdbmwdoKl9%2BgNnEk4Ruo4a4vN3%2FC4o4KnVkYQ%2BN5LHDlM%3D