I would simply like to run such query:
select * from `users` where SUBSTRING_INDEX(`email`, '@' ,-1) not in ('gmail.com, outlook.com');
Two ways crossed my mind which non of them work:
1
$providers = array('gmail.com', 'outlook.com');
$providers = "'" . implode("', '", $providers) . "'";
User::whereRaw("SUBSTRING_INDEX(`email`, '@' ,-1) not in (?)", $providers);
the above would not work because PDO will escape the "'" characters.
2
User::whereIn(DB::raw("SUBSTRING_INDEX(`email`, '@' ,-1)", $providers);
this one simply does not work. any idea?