database in laravel 8 code example
Example 1: db import laravel
use Illuminate\Support\Facades\DB;
Example 2: TRANSACTON LARAVEL QUERY BUILDER
DB::beginTransaction();
try {
DB::insert(...);
DB::commit();
} catch (\Throwable $e) {
DB::rollback();
throw $e;
}