User::query()
->where('name', 'LIKE', "%{$searchTerm}%")
->orWhere('email', 'LIKE', "%{$searchTerm}%")
->get();
reference:
https://freek.dev/1182-searching-models-using-a-where-like-query-in-laravel
$users = DB::table('users')
->where('name', 'like', 'T%')
->get();
/**
* filter the user result
*
* @var array
*/
public function users()
{
$search = "United States";
$users = User::where('country', 'LIKE', '%'.$search.'%')
->get();
dd($users);
}
Book::where('title', 'like', '%'.$this->search.'%')->get()
$book = array('book2','book3','book5');
$name = DB::Table('bookinfo')
->select('BookName', 'bookId')
->Where(function ($query) use($book) {
for ($i = 0; $i < count($book); $i++){
$query->orwhere('bookname', 'like', '%' . $book[$i] .'%');
}
})->get();
$users = DB::table('users')
->where('votes', '>=', 100)
->get();
$users = DB::table('users')
->where('votes', '<>', 100)
->get();
$users = DB::table('users')
->where('name', 'like', 'T%')
->get();
$admin_permissions = Permission::all();
// Teacher Role
$teacher_permissions = $admin_permissions->filter(function ($permission) {
return substr($permission->title, 0, 8) == 'teacher_';
});
BookingDates::where('email', Input::get('email'))
->orWhere('name', 'like', '%' . Input::get('name') . '%')->get();