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; 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();
]);
} }
} }