public static function checkForEmail($template, $email)
{
if (in_array($template, static::$safeTemplates)) {
return [];
}
if (empty($email)) {
return [];
}
if (!is_array($email)) {
$email = [$email => null];
}
$emails = array_keys($email);
return static::where(function ($q) use($template) {
$q->where('template', $template)->orWhere('template', '*');
})->whereIn('email', $emails)->lists('email');
}