Answers for "how to write an sql query in laravel eloquent"

PHP
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
2

DB: in eloquent using sql

$results = DB::select('select * from users where id = :id', ['id' => 1]);
Posted by: Guest on June-11-2020

Code answers related to "how to write an sql query in laravel eloquent"

Browse Popular Code Answers by Language