PHP code example of waelmoh / laravel-update-insert-many
1. Go to this page and download the library: Download waelmoh/laravel-update-insert-many library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
waelmoh / laravel-update-insert-many example snippets
User::updateMany($users); // update many models using id as the default key
User::updateMany($users, 'id'); // same as above
User::updateMany($users, 'username'); // use username as key instead of id
User::updateMany($users, ['username', 'email']); // use username and email as keys instead of id
User::updateMany($users, ['username', 'email'], ['last_name']); // update last name if username and email match