Save Progress.

This commit is contained in:
Daniel Meltzer
2016-12-27 19:24:41 -05:00
parent 13cf11368f
commit d262aec4c3
13 changed files with 136 additions and 42 deletions
+8 -2
View File
@@ -55,9 +55,9 @@ class Location extends SnipeModel
return $this->hasManyThrough('\App\Models\Asset', '\App\Models\User', 'location_id', 'assigned_to', 'id');
}
public function assignedassets()
public function locationAssets()
{
return $this->hasMany('\App\Models\Asset', 'rtd_location_id');
return $this->hasMany('\App\Models\Asset', 'rtd_location_id')->orHas('assignedAssets');
}
public function parent()
@@ -70,6 +70,12 @@ class Location extends SnipeModel
return $this->hasMany('\App\Models\Location', 'parent_id');
}
public function assignedAssets()
{
return $this->morphMany('App\Models\Asset', 'assigned', 'assigned_type', 'assigned_to')->withTrashed();
// return $this->hasMany('\App\Models\Asset', 'assigned_to')->withTrashed();
}
public static function getLocationHierarchy($locations, $parent_id = null)
{