Require this package with composer using the following command:
composer require cloudycity/laravel-builder-macros
After updating composer, add the service provider to the providers
array in config/app.php
CloudyCity\LaravelBuilderMacros\Providers\DatabaseServiceProvider::class,
Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.
- PHP 5.6 +
$query->insertUpdate($data);
// INSERT INTO TABLE ... VALUES ... ON DUPLICATE KEY UPDATE ...
$query->replace($data);
// REPLACE INTO TABLE ... VALUES ...
$query->insertIgnore($data);
// INSERT IGNORE INTO TABLE ... VALUES ...
$query->whereIntegerInRaw('uid', ['1', '2'])->get();
// for the old version
MIT