select where laravel eloquent code example
Example 1: laravel where like
$users = DB::table('users')
->where('name', 'like', 'T%')
->get();
Example 2: laravel update from query
$affected = DB::table('users')
->where('id', 1)
->update(['votes' => 1]);
Example 3: wherein laravel
DB::table('user')->whereIn('id', [100,200])->get();
Example 4: laravel sql query
use Illuminate\Support\Facades\DB;
$users = DB::select('select * from users');
foreach ($users as $user) {
echo $user->name;
}