Skip to content

Instantly share code, notes, and snippets.

@xorenio
Created March 24, 2017 15:31
Show Gist options
  • Save xorenio/3786ab1308d6e4f45db0a4e8ae74d466 to your computer and use it in GitHub Desktop.
Save xorenio/3786ab1308d6e4f45db0a4e8ae74d466 to your computer and use it in GitHub Desktop.
laravel oem query relations
<?php
// where has relation and key - value
// OR
// doesnt have a relation
->where(function($query){
$query->whereHas('report', function($q){$q->where('accepted', '<=', '0');})
->orWhereHas('report', function($q){$q;}, '<', 1);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment