Added requests() method on Assets

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2023-10-25 17:22:12 +01:00
parent 3a37b80251
commit 08693f09b0

View file

@ -786,7 +786,17 @@ class Asset extends Depreciable
return $this->belongsTo(\App\Models\Location::class, 'location_id');
}
/**
* Establishes the asset -> checkout_requests relationship
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v6.2.4]
* @return \Illuminate\Database\Eloquent\Relations\Relation
*/
public function requests()
{
return $this->belongsToMany(\App\Models\Asset::class, 'checkout_requests', 'requestable_id', 'user_id')->where('requestable_type','=',\App\Models\Asset::class);
}
/**
* Get the next autoincremented asset tag