$result = Marriage::where('name','LIKE','%'.$email_or_name.'%')
->orWhere('email','LIKE','%'.$email_or_name.'%')
->get();
// SEARCH QUERY
if (request()->has('search')){
$search = trim(request('search'));
$resumess = $resumess->where(function($query) use ($search){
$query->where('doc_name', 'LIKE', "%{$search}%");
$searches = explode(" ",$search);
foreach($searches as $s){
$query->orWhere('first_name', 'LIKE', "%{$s}%");
$query->orWhere('last_name', 'LIKE', "%{$s}%");
$query->orWhere('position_type', 'LIKE', "%{$s}%");
$query->orWhere('position_type', 'LIKE', "%{$s}%");
}
});
}
$searchTerm ='milad zamir Abc';
$reservedSymbols = ['-', '+', '<', '>', '@', '(', ')', '~'];
$searchTerm = str_replace($reservedSymbols, ' ', $searchTerm);
$searchValues = preg_split('/s+/', $searchTerm, -1, PREG_SPLIT_NO_EMPTY);
$res = User::where(function ($q) use ($searchValues) {
foreach ($searchValues as $value) {
$q->orWhere('name', 'like', "%{$value}%");
$q->orWhere('family_name', 'like', "%{$value}%");
}
})->get();
public function index()
{
$q = Dog::query();
if (Input::has('search'))
{
// simple where here or another scope, whatever you like
$q->where('name','like',Input::get('search'));
}
if (Input::has('search-breed'))
{
$q->searchBreed(Input::get('search-breed'));
}
if (Input::has('sex'))
{
$q->where('sex', Input::get('sex'));
}
if (Input::has('radius'))
{
$q->withinRadius(Input::get('radius'));
}
$dogs = $q->orderBy(..)->paginate(5);
// ...