mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
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:
parent
4b98711e07
commit
45d93ffa8c
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue