仓库
This commit is contained in:
@@ -15,8 +15,10 @@ class LocationController
|
|||||||
{
|
{
|
||||||
$locations = Location::hasVehicles()
|
$locations = Location::hasVehicles()
|
||||||
->with('vehicles')
|
->with('vehicles')
|
||||||
|
->with('fboVehicles')
|
||||||
->get()
|
->get()
|
||||||
->map(function ($location) {
|
->map(function ($location) {
|
||||||
|
$location->fbo_vehicle_count = $location->fbo_vehicles->count();
|
||||||
$location->vehicle_count = $location->vehicles->count();
|
$location->vehicle_count = $location->vehicles->count();
|
||||||
return $location;
|
return $location;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ class Location extends Model
|
|||||||
return $this->hasMany(Vehicle::class, 'locations_id', 'id');
|
return $this->hasMany(Vehicle::class, 'locations_id', 'id');
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
* 目的地关联
|
||||||
* Get the vehicles for the location.
|
* Get the vehicles for the location.
|
||||||
*/
|
*/
|
||||||
public function finalVehicles()
|
public function finalVehicles()
|
||||||
@@ -42,6 +43,14 @@ class Location extends Model
|
|||||||
return $this->hasMany(Vehicle::class, 'final_locations_id', 'id');
|
return $this->hasMany(Vehicle::class, 'final_locations_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the FBO vehicles for the location.
|
||||||
|
*/
|
||||||
|
public function fboVehicles()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Vehicle::class, 'fbo_locations_id', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scope a query to only include locations that have vehicles.
|
* Scope a query to only include locations that have vehicles.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user