Last active
September 19, 2017 12:36
-
-
Save uno-de-piera/cb945a3060a667ab19a3866ad0b2b98d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function store() | |
{ | |
$error = null; | |
DB::beginTransaction(); | |
try { | |
Module::buildComponent("type1"); | |
Module::buildComponent("type2"); | |
Module::buildComponent("type3"); | |
DB::commit(); | |
$success = true; | |
} catch (\Exception $e) { | |
$success = false; | |
$error = $e->getMessage(); | |
DB::rollback(); | |
} | |
if ($success) { | |
//success | |
} | |
//error | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment