mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-11 13:57:41 -08:00
Added helper method for uploads
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
276f534ded
commit
3d3a4b02fc
|
@ -88,6 +88,24 @@ class Component extends SnipeModel
|
||||||
'location' => ['name'],
|
'location' => ['name'],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Establishes the components -> action logs -> uploads relationship
|
||||||
|
*
|
||||||
|
* @author A. Gianotto <snipe@snipe.net>
|
||||||
|
* @since [v6.1.13]
|
||||||
|
* @return \Illuminate\Database\Eloquent\Relations\Relation
|
||||||
|
*/
|
||||||
|
public function uploads()
|
||||||
|
{
|
||||||
|
return $this->hasMany(\App\Models\Actionlog::class, 'item_id')
|
||||||
|
->where('item_type', '=', self::class)
|
||||||
|
->where('action_type', '=', 'uploaded')
|
||||||
|
->whereNotNull('filename')
|
||||||
|
->orderBy('created_at', 'desc');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Establishes the component -> location relationship
|
* Establishes the component -> location relationship
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue