Answers for "laravel query like"

PHP
5

where like laravel

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
Posted by: Guest on December-19-2020
6

laravel orWhere

$camps = $field->camps()->where('status', 0)->where(function ($q) {
    $q->where('sex', Auth::user()->sex)->orWhere('sex', 0);
})->get();
Posted by: Guest on October-20-2020
8

laravel where like

$users = DB::table('users')
                ->where('name', 'like', 'T%')
                ->get();
Posted by: Guest on May-13-2020
0

where like laravel

$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();
Posted by: Guest on March-11-2021
0

where like in laravel

$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();
Posted by: Guest on August-17-2021
0

laravel wherein like

$admin_permissions = Permission::all();
// Teacher Role
$teacher_permissions = $admin_permissions->filter(function ($permission) {
  return substr($permission->title, 0, 8) == 'teacher_';
});
Posted by: Guest on October-09-2020

Browse Popular Code Answers by Language