Refactor of #15235 - added accessory checkout to locations, assets

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe
2024-12-02 20:53:00 +00:00
committed by Brady Wetherington
parent edacc4eb54
commit 183a4d49d8
77 changed files with 839 additions and 277015 deletions
+12
View File
@@ -253,6 +253,18 @@ class Location extends SnipeModel
return $this->morphMany(\App\Models\Asset::class, 'assigned', 'assigned_type', 'assigned_to')->withTrashed();
}
/**
* Establishes the accessory -> location assignment relationship
*
* @author A. Gianotto <snipe@snipe.net>
* @since [v3.0]
* @return \Illuminate\Database\Eloquent\Relations\Relation
*/
public function assignedAccessories()
{
return $this->morphMany(\App\Models\AccessoryCheckout::class, 'assigned', 'assigned_type', 'assigned_to');
}
public function setLdapOuAttribute($ldap_ou)
{
return $this->attributes['ldap_ou'] = empty($ldap_ou) ? null : $ldap_ou;