You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//variables
$fileds = ['email','name'];
$values = ['example.net','Taylor Otwell'];
//first Argument will be array of fileds that need to be searched in the Query
//second Argument will be array of values that to be searched
//third Argument will be array of patterns for exploding the each string
//if its set to true the values will be exploded as ['example.net','Taylor','Otwell'];
//fourth Argument will be boolean for the adding own wild card
//if its set to true the values in the sql will be processed as follows
//%eachValues%
$query = User:: search($fileds, $values,['.',' ','@'],true)->select('name','email')->get();
//So query result will be
select
`name`,
`email`
from
`users`
where
(
(
`email` LIKE "%example%"
or `email` LIKE "%net%"
or `email` LIKE "%Taylor%"
or `email` LIKE "%Otwell%"
)
or (
`name` LIKE "%example%"
or `name` LIKE "%net%"
or `name` LIKE "%Taylor%"
or `name` LIKE "%Otwell%"
)
)
and `users`.`deleted_at` is null