mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-21 03:15:45 -08:00
Fixed Locations transformer for assigned assets
This commit is contained in:
parent
231f4dce07
commit
c7003897ae
|
@ -7,11 +7,13 @@ use Illuminate\Database\Eloquent\Collection;
|
||||||
class LocationsTransformer
|
class LocationsTransformer
|
||||||
{
|
{
|
||||||
|
|
||||||
public function transformLocations (Collection $locations)
|
public function transformLocations (Collection $locations, $total)
|
||||||
{
|
{
|
||||||
$locations_array = array();
|
$array = array();
|
||||||
$locations_array[] = self::transformLocation($locations);
|
foreach ($locations as $location) {
|
||||||
return $locations_array;
|
$array[] = self::transformLocation($location);
|
||||||
|
}
|
||||||
|
return (new DatatablesTransformer)->transformDatatables($array, $total);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function transformLocation (Location $location = null)
|
public function transformLocation (Location $location = null)
|
||||||
|
@ -23,6 +25,8 @@ class LocationsTransformer
|
||||||
'address' => e($location->address),
|
'address' => e($location->address),
|
||||||
'city' => e($location->city),
|
'city' => e($location->city),
|
||||||
'state' => e($location->state),
|
'state' => e($location->state),
|
||||||
|
'assets_checkedout' => $location->assets()->count(),
|
||||||
|
'assets_default' => $location->assignedassets()->count(),
|
||||||
'country' => e($location->country),
|
'country' => e($location->country),
|
||||||
];
|
];
|
||||||
return $transformed;
|
return $transformed;
|
||||||
|
|
Loading…
Reference in a new issue