Search
 
SCRIPT & CODE EXAMPLE
 

PHP

avoid data insertion if an error occurs in laravel

try {
        //start the transaction
        DB::beginTransaction();

        DB::table('XYZ')->update(['abc'=>'ABC']);
        DB::table('EG')->delete();

        //commit the transaction
        DB::commit();
} catch (Exception $e) {
        DB::rollBack();
        return response;
}
Comment

PREVIOUS NEXT
Code Example
Php :: Indexed Array 
Php :: laravel count 
Php :: laravel notion add enviroment 
Php :: php random string for filename 
Php :: number to words gujarati php 
Php :: GZIP COMPRESSION Using PHP 
Php :: laravel helper.php session data 
Php :: hirudhi 
Php :: Generating Random String In PHP Using Hashing Functions 
Php :: Add ACF to single.php 
Php :: default time zone for europe php 
Php :: amazon ami 2 php ini 
Php :: Définir un nombre maximum de mots sur les titres des publications WordPress 
Php :: how to count number of rows in sql using php 
Php :: Laravel Cache store [none] is not defined. 
Php :: laravel components scripts 
Php :: laravel 8 storing dynamic checkbox integer value array 
Php :: get current page name for page active class 
Php :: cf7 first_as_label 
Php :: php artisan tinker new record 
Php :: wp register_setting access saved value 
Php :: php text in thml 
Php :: rollback a specific migration laravel 
Php :: symfony send exception 
Php :: laravel collection min 
Php :: laravel 8 ui auth 
Php :: conect_from_db_datalayer 
Php :: php print array as string 
Php :: supprimer un cookie avec un input en php 
Php :: laravel api routes 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =