laravel 8 add to database code example
Example 1: TRANSACTON LARAVEL QUERY BUILDER
DB::beginTransaction();
try {
DB::insert(...);
DB::commit();
} catch (\Throwable $e) {
DB::rollback();
throw $e;
}
Example 2: Writing into the database with one click laravel
<!DOCTYPE html>
<html>
<head> </head>
<body> This should </body>
<br><br><br><br>
<form method="post">
<button type="button"> submit </button>
</form>
</html>