fixed scope for revenu/payment
This commit is contained in:
parent
76b1196200
commit
92eaf16693
@ -22,7 +22,7 @@ trait Scopes
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$type = request()->get('type') ?: Str::singular(request()->segment(2, ''));
|
$type = request()->get('type') ?: $this->getTypeFromUrl();
|
||||||
|
|
||||||
// Apply type scope
|
// Apply type scope
|
||||||
$builder->where($model->getTable() . '.type', '=', $type);
|
$builder->where($model->getTable() . '.type', '=', $type);
|
||||||
@ -59,4 +59,19 @@ trait Scopes
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getTypeFromUrl()
|
||||||
|
{
|
||||||
|
$type = Str::singular(request()->segment(2, ''));
|
||||||
|
|
||||||
|
if ($type == 'revenue') {
|
||||||
|
$type = 'income';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($type == 'payment') {
|
||||||
|
$type = 'expense';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $type;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user