Skip to content

Instantly share code, notes, and snippets.

@andrewhl
Created February 3, 2015 20:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewhl/12b01796b4c0668862f9 to your computer and use it in GitHub Desktop.
Save andrewhl/12b01796b4c0668862f9 to your computer and use it in GitHub Desktop.
public function scopeByInStore($query)
{
return GiftCardTransaction::whereHas('GiftCard', function ($query)
{
$query->whereHas('GiftCardBatch', function ($query)
{
$inStoreOrderType = GiftCardOrderTypes::$inStore;
$id = GiftCardBatch::where('name', '=', $inStoreOrderType)->first()->id;
$query->where('id', $id);
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment