protected function campaignFromInput() { $c = $this->campaign->where('permalink', '=', Input::get('campaign'))->first(); if (!$c) { $c = Campaign::current(); } return $c; }
public function index($permalink = null) { $selectedOrg = null; if ($permalink) { $rawOrg = Organization::wherePermalink($permalink)->with('beneficiaries')->first(); $selectedOrg = $this->transformer->transform($rawOrg); } $allOrgs = Organization::orderBy('name')->get(); return View::make($this->package . '::frontend.organizations.index', ['campaign' => Campaign::current(), 'selectedOrg' => $selectedOrg, 'allOrgs' => $allOrgs]); }
public function __construct(array $attrs = array()) { parent::__construct($attrs); if ($campaign = Campaign::current()) { $this->campaign_id = $campaign->id; } $this->configureValidations(); static::saving(function ($obj) { unset($obj->email_confirmation); }); }
public function scopeCurrent($query) { return $query->whereHas('campaigns', function ($q) { $q->whereCampaignId(Campaign::current()->id); }); }
public function scopeCurrentCampaign($query) { return $query->whereHas('opportunity', function ($q2) { $q2->whereCampaignId(Campaign::current()->id); }); }