Fix for all airport expenses being applied #729

This commit is contained in:
Nabeel Shahzad
2020-05-26 18:41:25 -04:00
parent c67e45e98e
commit 5b16c88bcb
3 changed files with 122 additions and 14 deletions

View File

@@ -24,13 +24,14 @@ class ExpenseRepository extends Repository implements CacheableInterface
* Get all of the expenses for a given type, and also
* include expenses for a given airline ID
*
* @param $type
* @param null $airline_id
* @param null $ref_model
* @param $type
* @param int $airline_id
* @param string $ref_model
* @param mixed $ref_model_id
*
* @return Collection
*/
public function getAllForType($type, $airline_id = null, $ref_model = null)
public function getAllForType($type, $airline_id = null, $ref_model = null, $ref_model_id = null)
{
$where = [
'type' => $type,
@@ -47,6 +48,10 @@ class ExpenseRepository extends Repository implements CacheableInterface
if ($ref_model) {
$where['ref_model'] = $ref_model_type;
}
if ($ref_model_id) {
$where['ref_model_id'] = $ref_model_id;
}
}
$expenses = $this->findWhere($where);