From b3bb8c386f7f943fe9cf87b25ae0130d6729d63c Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 26 Jul 2017 16:40:00 +0200 Subject: [PATCH] Fix routes for #718 --- app/Http/Controllers/BillController.php | 2 +- app/Http/Controllers/BudgetController.php | 6 +++--- app/Http/Controllers/CategoryController.php | 4 ++-- app/Http/Controllers/TagController.php | 4 ++-- app/Http/Controllers/TransactionController.php | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/Http/Controllers/BillController.php b/app/Http/Controllers/BillController.php index 8a963cd57f..e36fb62b2c 100644 --- a/app/Http/Controllers/BillController.php +++ b/app/Http/Controllers/BillController.php @@ -217,7 +217,7 @@ class BillController extends Controller $collector->setAllAssetAccounts()->setBills(new Collection([$bill]))->setLimit($pageSize)->setPage($page)->withBudgetInformation() ->withCategoryInformation(); $journals = $collector->getPaginatedJournals(); - $journals->setPath('/bills/show/' . $bill->id); + $journals->setPath(route('bills.show', [$bill->id])); $bill->nextExpectedMatch = $repository->nextExpectedMatch($bill, new Carbon); $hideBill = true; diff --git a/app/Http/Controllers/BudgetController.php b/app/Http/Controllers/BudgetController.php index 713bf8e714..b156be96e5 100644 --- a/app/Http/Controllers/BudgetController.php +++ b/app/Http/Controllers/BudgetController.php @@ -308,7 +308,7 @@ class BudgetController extends Controller $collector->setAllAssetAccounts()->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->setLimit($pageSize)->setPage($page) ->withoutBudget()->withOpposingAccount(); $journals = $collector->getPaginatedJournals(); - $journals->setPath('/budgets/list/no-budget'); + $journals->setPath(route('budgets.no-budget')); $count = $journals->getCollection()->count(); if ($count === 0 && $loop < 3) { $start->subDay(); @@ -366,7 +366,7 @@ class BudgetController extends Controller $collector = app(JournalCollectorInterface::class); $collector->setAllAssetAccounts()->setRange($start, $end)->setBudget($budget)->setLimit($pageSize)->setPage($page)->withCategoryInformation(); $journals = $collector->getPaginatedJournals(); - $journals->setPath('/budgets/show/' . $budget->id); + $journals->setPath(route('budgets.show', [$budget->id])); $subTitle = trans('firefly.all_journals_for_budget', ['name' => $budget->name]); @@ -404,7 +404,7 @@ class BudgetController extends Controller $collector->setAllAssetAccounts()->setRange($budgetLimit->start_date, $budgetLimit->end_date) ->setBudget($budget)->setLimit($pageSize)->setPage($page)->withCategoryInformation(); $journals = $collector->getPaginatedJournals(); - $journals->setPath('/budgets/show/' . $budget->id . '/' . $budgetLimit->id); + $journals->setPath(route('budgets.show', [$budget->id, $budgetLimit->id])); $start = session('first', Carbon::create()->startOfYear()); diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.php index 4cf4389a2a..1eb6f71ed7 100644 --- a/app/Http/Controllers/CategoryController.php +++ b/app/Http/Controllers/CategoryController.php @@ -214,7 +214,7 @@ class CategoryController extends Controller $collector->setAllAssetAccounts()->setRange($start, $end)->setLimit($pageSize)->setPage($page)->withoutCategory()->withOpposingAccount(); $collector->removeFilter(InternalTransferFilter::class); $journals = $collector->getPaginatedJournals(); - $journals->setPath('/categories/list/no-category'); + $journals->setPath(route('categories.no-category')); $count = $journals->getCollection()->count(); if ($count === 0 && $loop < 3) { $start->subDay(); @@ -298,7 +298,7 @@ class CategoryController extends Controller ->setCategory($category)->withBudgetInformation()->withCategoryInformation(); $collector->removeFilter(InternalTransferFilter::class); $journals = $collector->getPaginatedJournals(); - $journals->setPath('categories/show/' . $category->id); + $journals->setPath(route('categories.show', [$category->id])); $count = $journals->getCollection()->count(); if ($count === 0 && $loop < 3) { $start->subDay(); diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.php index f373fa7dff..4342c8fcd2 100644 --- a/app/Http/Controllers/TagController.php +++ b/app/Http/Controllers/TagController.php @@ -246,7 +246,7 @@ class TagController extends Controller $periods = new Collection; $apiKey = env('GOOGLE_MAPS_API_KEY', ''); $sum = '0'; - $path = 'tags/show/' . $tag->id; + $path = route('tags.show', [$tag->id]); // prep for "all" view. @@ -255,7 +255,7 @@ class TagController extends Controller $start = $repository->firstUseDate($tag); $end = new Carbon; $sum = $repository->sumOfTag($tag); - $path = 'tags/show/' . $tag->id . '/all'; + $path = route('tags.show', [$tag->id,'all']); } // prep for "specific date" view. diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.php index 6919679807..d3bdd0ed59 100644 --- a/app/Http/Controllers/TransactionController.php +++ b/app/Http/Controllers/TransactionController.php @@ -78,7 +78,7 @@ class TransactionController extends Controller $start = null; $end = null; $periods = new Collection; - $path = '/transactions/' . $what; + $path = route('transactions.index', [$what]); // prep for "all" view. if ($moment === 'all') { @@ -86,14 +86,14 @@ class TransactionController extends Controller $first = $repository->first(); $start = $first->date ?? new Carbon; $end = new Carbon; - $path = '/transactions/' . $what . '/all/'; + $path = route('transactions.index', [$what, 'all']); } // prep for "specific date" view. if (strlen($moment) > 0 && $moment !== 'all') { $start = new Carbon($moment); $end = Navigation::endOfPeriod($start, $range); - $path = '/transactions/' . $what . '/' . $moment; + $path = route('transactions.index', [$what, $moment]); $subTitle = trans( 'firefly.title_' . $what . '_between', ['start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]