Skip to content

Instantly share code, notes, and snippets.

@cronoh
Created December 21, 2016 16:36
Show Gist options
  • Save cronoh/1b3114e4e95ed6a0353724f408ce23f6 to your computer and use it in GitHub Desktop.
Save cronoh/1b3114e4e95ed6a0353724f408ce23f6 to your computer and use it in GitHub Desktop.
$variable = static::where('name', $name)
->whereHas('widget', function ($q) use ($widget) {
$q->where('name', $widget);
})
->first();
return $variable ? : false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment