use DB and with laravel code example
Example 1: TRANSACTON LARAVEL QUERY BUILDER
DB::beginTransaction();
try {
DB::insert(...);
DB::commit();
} catch (\Throwable $e) {
DB::rollback();
throw $e;
}
Example 2: laravel find query
foreach ($flights as $flight) {
echo $flight->name;
}
Example 3: db name laravel
DB::connection()->getDatabaseName() //laravel