laravel wherein query code example
Example 1: laravel not in query
DB::table(..)->select(..)->whereNotIn('book_price', [100,200])->get();
Example 2: wherein laravel
DB::table('user')->whereIn('id', [100,200])->get();
Example 3: join in laravel eloquent
$customer = DB::table('customers')
->join('shops', 'customers.shop_id', '=', 'shops.shop_id')
->where('customer_contact', $contact_no)
->get();
Example 4: Laravel query where and
Table::where('Column', Value)->where('NewColumn', Value)->get();
Example 5: laravel wherein like
$admin_permissions = Permission::all();
$teacher_permissions = $admin_permissions->filter(function ($permission) {
return substr($permission->title, 0, 8) == 'teacher_';
});