Skip to content

Instantly share code, notes, and snippets.

@alnutile
Created November 13, 2014 12:53
Show Gist options
  • Save alnutile/0eedd5231b33cf7611fc to your computer and use it in GitHub Desktop.
Save alnutile/0eedd5231b33cf7611fc to your computer and use it in GitHub Desktop.
You need to set !== to set an exact match since 0 would = false otherwise and never be true here
public function getActiveAttribute($value)
{
if($this->site_override()->first() != null && ($this->site_override()->first()->active !== null))
{
return $this->site_override()->first()->active;
}
return $value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment