laravel use db
snippet in php

laravel use db

user9540

use Illuminate\Support\Facades\DB;

TRANSACTON LARAVEL QUERY BUILDER

user5465

DB::beginTransaction();

try {
    DB::insert(...);    
    DB::commit();
} catch (\Throwable $e) {
    DB::rollback();
    throw $e;
}

DB: in eloquent using sql

user8732

$results = DB::select('select * from users where id = :id', ['id' => 1]);