{"repo":"iksaku/laravel-mass-update","free":true,"listed":false,"github":"https://github.com/iksaku/laravel-mass-update","clone":"git clone https://github.com/iksaku/laravel-mass-update.git","description":"Update multiple Laravel Model records, each with its own set of values, sending a single query to your database!","language":"PHP","stars":137,"topics":["php","laravel","eloquent","sql"],"license":"MIT","category":"databases-storage","readme_excerpt":"Laravel Mass Update Update multiple Laravel Model records, each with its own set of values, sending a single query to your database! Installation You can install the package via composer: Usage In your model class, add the Iksaku\\Laravel\\MassUpdate\\MassUpdatable trait: And that's all! Your model is now ready to update multiple records with varying values in a single query! Let's take a look at some possible use cases for this new query: Simple use case: Update the values of multiple records Imagine that you have the following users table: id name username -- -------------- -------- 1 Jorge Gonzales iksaku 2 Gladys Martines gm mtz But, we want to update both records since those users have told us that their legal last name was misspelled: González is written with an accent on the letter a , and only uses z , never an s . Martínez is written with an accent on the letter i , and last letter should be a z , not an s Well, we can mass update those specific records: Now, both records will be updated with their corresponding values in a single query, resulting in: id name username -- --------------- -------- 1 Jorge González iksaku 2 Gladys Martínez gm mtz By default, the massUpdate query will grab your model's primary key name and apply it as part of the query to not affect other records. If you want to use another column as an index to separate value types, you could pass it as a second argument to the function call: Simple use case #2: Updating multiple Eloquent Models If you nee","default_branch":null,"files":null,"tree":[],"storefront":"/r/iksaku","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/iksaku/laravel-mass-update/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}