Use new accessory checkout relationship

This commit is contained in:
Marcus Moore 2024-08-05 17:26:11 -07:00
parent f2b78d18a4
commit 94e00b8a3e
No known key found for this signature in database

View file

@ -3,6 +3,7 @@
namespace Feature\Users\Ui\BulkActions;
use App\Models\Accessory;
use App\Models\AccessoryCheckout;
use App\Models\Asset;
use App\Models\Consumable;
use App\Models\License;
@ -230,10 +231,9 @@ class BulkDeleteUsersTest extends TestCase
private function attachAccessoryToUsers(Accessory $accessory, array $users): void
{
foreach ($users as $user) {
$accessory->users()->attach($accessory->id, [
'accessory_id' => $accessory->id,
'assigned_to' => $user->id,
]);
$a = $accessory->checkouts()->make();
$a->assignedTo()->associate($user);
$a->save();
}
}