A free open source IT asset/license management system
Fix relationships in AccessoryCheckout model
Marcus Moore5abcdb8c5ad9
diff --git a/app/Models/AccessoryCheckout.php b/app/Models/AccessoryCheckout.phpindex 9f49354389..4e12086c53 100755--- a/app/Models/AccessoryCheckout.php+++ b/app/Models/AccessoryCheckout.php@@ -20,6 +20,7 @@ use Watson\Validating\ValidatingTrait;*/class AccessoryCheckout extends Model{+ use HasFactory;use Searchable;protected $fillable = [@@ -41,7 +42,7 @@ class AccessoryCheckout extends Model*/public function accessory(){- return $this->hasOne(Accessory::class, 'id', 'accessory_id');+ return $this->belongsTo(Accessory::class);}public function accessories()@@ -57,7 +58,7 @@ class AccessoryCheckout extends Model*/public function adminuser(){- return $this->hasOne(\App\Models\User::class, 'id', 'created_by');+ return $this->belongsTo(User::class, 'created_by');}/**diff --git a/tests/Feature/Notifications/Email/AcceptanceReminderTest.php b/tests/Feature/Notifications/Email/AcceptanceReminderTest.phpindex 2965f4610b..da72fe4ed6 100644--- a/tests/Feature/Notifications/Email/AcceptanceReminderTest.php+++ b/tests/Feature/Notifications/Email/AcceptanceReminderTest.php@@ -7,6 +7,7 @@ use App\Mail\CheckoutAssetMail;use App\Mail\CheckoutConsumableMail;use App\Mail\CheckoutLicenseMail;use App\Models\Accessory;+use App\Models\AccessoryCheckout;use App\Models\Actionlog;use App\Models\Asset;use App\Models\CheckoutAcceptance;@@ -115,6 +116,12 @@ class AcceptanceReminderTest extends TestCase$this->createActionLogEntry($accessory, $this->admin, $this->assignee, $acceptance);+ AccessoryCheckout::factory()+ ->for($this->admin, 'adminuser')+ ->for($accessory)+ ->for($this->assignee, 'assignedTo')+ ->create();+$this->actingAs($this->admin)->post(route('reports/unaccepted_assets_sent_reminder', ['acceptance_id' => $acceptance->id,