mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 13:44:06 -08:00
Use new accessory checkout relationship
This commit is contained in:
parent
f2b78d18a4
commit
94e00b8a3e
|
@ -3,6 +3,7 @@
|
||||||
namespace Feature\Users\Ui\BulkActions;
|
namespace Feature\Users\Ui\BulkActions;
|
||||||
|
|
||||||
use App\Models\Accessory;
|
use App\Models\Accessory;
|
||||||
|
use App\Models\AccessoryCheckout;
|
||||||
use App\Models\Asset;
|
use App\Models\Asset;
|
||||||
use App\Models\Consumable;
|
use App\Models\Consumable;
|
||||||
use App\Models\License;
|
use App\Models\License;
|
||||||
|
@ -230,10 +231,9 @@ class BulkDeleteUsersTest extends TestCase
|
||||||
private function attachAccessoryToUsers(Accessory $accessory, array $users): void
|
private function attachAccessoryToUsers(Accessory $accessory, array $users): void
|
||||||
{
|
{
|
||||||
foreach ($users as $user) {
|
foreach ($users as $user) {
|
||||||
$accessory->users()->attach($accessory->id, [
|
$a = $accessory->checkouts()->make();
|
||||||
'accessory_id' => $accessory->id,
|
$a->assignedTo()->associate($user);
|
||||||
'assigned_to' => $user->id,
|
$a->save();
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue