Skip to content

Instantly share code, notes, and snippets.

View softaris's full-sized avatar

Dan softaris

  • Germany
View GitHub Profile

I checked the source code, union seems to be kind of hardcoded, in way that's not easy to use ->union(...)but substitute 'intersect' under the hood.

that said, you can manually do it long-form like this:

$q = DB::table('items')->where('id','>', 1)->union(DB::table('items')->where('id', '<', 5));
DB::select(str_replace('union', 'intersect', $q->toSql()), $q->getBindings());

or better:

$q1 = DB::table('items')-&gt;where('id','&gt;', 1);
@zanechua
zanechua / azure-pipelines.yml
Last active September 23, 2024 09:41
Azure Pipeline + Laravel + MySQL + PHPUnit + Laravel Dusk
# PHP
# Test and package your PHP project.
# Add steps that run tests, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/php
pool:
vmImage: 'Ubuntu 16.04'
variables:
phpVersion: 7.2