Created
November 18, 2014 14:37
-
-
Save ollieread/2be55db54c411df33a8a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// This would be for the logs model | |
public function scopeCode($query, $code) | |
{ | |
return $query->where('code', $code); | |
} | |
// Then this would be your main model | |
public function scopeNotTransferred($query) | |
{ | |
return $query->whereHas('logs', function($query) | |
{ | |
$query->code('transferred'); | |
}, '<', 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment