Answers for "select where laravel eloquent"

PHP
10

laravel update from query

$affected = DB::table('users')
              ->where('id', 1)
              ->update(['votes' => 1]);
Posted by: Guest on May-07-2020
8

laravel where like

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

wherein laravel

DB::table('user')->whereIn('id', [100,200])->get();
Posted by: Guest on December-16-2020
2

eloquent with select

Post::query()
    ->with(array('user' => function($query) {
        $query->select('id','username');
    }))
    ->get();
Posted by: Guest on August-07-2021
0

laravel sql query

use Illuminate\Support\Facades\DB;

$users = DB::select('select * from users');

foreach ($users as $user) {
    echo $user->name;
}
Posted by: Guest on January-07-2021

Code answers related to "select where laravel eloquent"

Browse Popular Code Answers by Language