Scopes

John Hoskins • November 22, 2020

Since we will be using campaigns throughout, we should have a forCampaign scope on lots of data.

Also, forOrganization for others items that are organization based.

Link: https://laravel.com/docs/8.x/eloquent#dynamic-scopes

public function scopeForCampaign($query, $campaign_id)
    {
        return $query->where('campaign_id', $campaign_id);
    }