Skip to content

Instantly share code, notes, and snippets.

@andrewhl
Created February 3, 2015 22:41
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/fc87dc6c72056f9f26ce to your computer and use it in GitHub Desktop.
Save andrewhl/fc87dc6c72056f9f26ce to your computer and use it in GitHub Desktop.
public function scopeByInStore($query)
{
$inStoreOrderType = GiftCardOrderTypes::$inStore;
$id = GiftCardBatch::where('name', '=', $inStoreOrderType)->first()->id;
$inStoreGiftCardIds = GiftCard::where('gift_card_batch_id', '=', $id)
->lists('id');
return $query->whereIn('gift_card_id', $inStoreGiftCardIds);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment