Use a transaction while creating license seats. Makes adding a license with a large number of seats much more managable.

This commit is contained in:
Daniel Meltzer 2016-05-17 23:44:27 -05:00
parent 4b98711e07
commit 45d93ffa8c

View file

@ -156,6 +156,7 @@ class LicensesController extends Controller
$insertedId = $license->id;
// Save the license seat data
DB::transaction(function() use (&$insertedId,&$license) {
for ($x=0; $x<$license->seats; $x++) {
$license_seat = new LicenseSeat();
$license_seat->license_id = $insertedId;
@ -164,6 +165,7 @@ class LicensesController extends Controller
$license_seat->notes = null;
$license_seat->save();
}
});
// Redirect to the new license page