mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Layout updates and extensions. Found a problem I need closures for. Yay! [skip ci]
This commit is contained in:
@@ -29,7 +29,7 @@ class EloquentBudgetRepository implements BudgetRepositoryInterface
|
||||
public function get()
|
||||
{
|
||||
$set = \Auth::user()->budgets()->with(
|
||||
['limits' => function ($q) {
|
||||
['limits' => function ($q) {
|
||||
$q->orderBy('limits.startdate', 'ASC');
|
||||
}, 'limits.limitrepetitions' => function ($q) {
|
||||
$q->orderBy('limit_repetitions.startdate', 'ASC');
|
||||
@@ -46,6 +46,31 @@ class EloquentBudgetRepository implements BudgetRepositoryInterface
|
||||
return $set;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* @return mixed
|
||||
*/
|
||||
public function update($data) {
|
||||
$budget = $this->find($data['id']);
|
||||
if ($budget) {
|
||||
// update account accordingly:
|
||||
$budget->name = $data['name'];
|
||||
if ($budget->validate()) {
|
||||
$budget->save();
|
||||
}
|
||||
}
|
||||
return $budget;
|
||||
}
|
||||
|
||||
public function destroy($budgetId) {
|
||||
$budget = $this->find($budgetId);
|
||||
if($budget) {
|
||||
$budget->delete();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|mixed
|
||||
*/
|
||||
@@ -72,7 +97,7 @@ class EloquentBudgetRepository implements BudgetRepositoryInterface
|
||||
{
|
||||
|
||||
$set = \Auth::user()->budgets()->with(
|
||||
['limits' => function ($q) use ($date) {
|
||||
['limits' => function ($q) use ($date) {
|
||||
$q->orderBy('limits.startdate', 'ASC');
|
||||
}, 'limits.limitrepetitions' => function ($q) use ($date) {
|
||||
$q->orderBy('limit_repetitions.startdate', 'ASC');
|
||||
@@ -156,7 +181,7 @@ class EloquentBudgetRepository implements BudgetRepositoryInterface
|
||||
$limit->save();
|
||||
}
|
||||
}
|
||||
if($budget->validate()) {
|
||||
if ($budget->validate()) {
|
||||
$budget->save();
|
||||
}
|
||||
return $budget;
|
||||
|
Reference in New Issue
Block a user