diff --git a/app/Helpers/Csv/Converter/Date.php b/app/Helpers/Csv/Converter/Date.php index d2487ccd24..1024e6e42c 100644 --- a/app/Helpers/Csv/Converter/Date.php +++ b/app/Helpers/Csv/Converter/Date.php @@ -6,7 +6,6 @@ use Carbon\Carbon; use FireflyIII\Exceptions\FireflyException; use InvalidArgumentException; use Log; -use Session; /** * Class Date @@ -22,7 +21,7 @@ class Date extends BasicConverter implements ConverterInterface */ public function convert() { - $format = Session::get('csv-date-format'); + $format = session('csv-date-format'); try { $date = Carbon::createFromFormat($format, $this->value); } catch (InvalidArgumentException $e) { diff --git a/app/Helpers/Csv/Data.php b/app/Helpers/Csv/Data.php index 32e1ca4477..da4cc224fb 100644 --- a/app/Helpers/Csv/Data.php +++ b/app/Helpers/Csv/Data.php @@ -260,63 +260,63 @@ class Data protected function sessionCsvFileLocation() { if (Session::has('csv-file')) { - $this->csvFileLocation = (string)Session::get('csv-file'); + $this->csvFileLocation = (string)session('csv-file'); } } protected function sessionDateFormat() { if (Session::has('csv-date-format')) { - $this->dateFormat = (string)Session::get('csv-date-format'); + $this->dateFormat = (string)session('csv-date-format'); } } protected function sessionDelimiter() { if (Session::has('csv-delimiter')) { - $this->delimiter = Session::get('csv-delimiter'); + $this->delimiter = session('csv-delimiter'); } } protected function sessionHasHeaders() { if (Session::has('csv-has-headers')) { - $this->hasHeaders = (bool)Session::get('csv-has-headers'); + $this->hasHeaders = (bool)session('csv-has-headers'); } } protected function sessionImportAccount() { if (Session::has('csv-import-account')) { - $this->importAccount = intval(Session::get('csv-import-account')); + $this->importAccount = intval(session('csv-import-account')); } } protected function sessionMap() { if (Session::has('csv-map')) { - $this->map = (array)Session::get('csv-map'); + $this->map = (array)session('csv-map'); } } protected function sessionMapped() { if (Session::has('csv-mapped')) { - $this->mapped = (array)Session::get('csv-mapped'); + $this->mapped = (array)session('csv-mapped'); } } protected function sessionRoles() { if (Session::has('csv-roles')) { - $this->roles = (array)Session::get('csv-roles'); + $this->roles = (array)session('csv-roles'); } } protected function sessionSpecifix() { if (Session::has('csv-specifix')) { - $this->specifix = (array)Session::get('csv-specifix'); + $this->specifix = (array)session('csv-specifix'); } } } diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php index 44d210ca40..2c2083522b 100644 --- a/app/Http/Controllers/AccountController.php +++ b/app/Http/Controllers/AccountController.php @@ -22,7 +22,7 @@ use View; class AccountController extends Controller { /** - * @codeCoverageIgnore + * */ public function __construct() { @@ -44,7 +44,7 @@ class AccountController extends Controller $subTitle = trans('firefly.make_new_' . $what . '_account'); // put previous url in session if not redirect from store (not "create another"). - if (Session::get('accounts.create.fromStore') !== true) { + if (session('accounts.create.fromStore') !== true) { Session::put('accounts.create.url', URL::previous()); } Session::forget('accounts.create.fromStore'); @@ -94,7 +94,7 @@ class AccountController extends Controller Session::flash('success', trans('firefly.' . $typeName . '_deleted', ['name' => $name])); Preferences::mark(); - return redirect(Session::get('accounts.delete.url')); + return redirect(session('accounts.delete.url')); } /** @@ -112,7 +112,7 @@ class AccountController extends Controller $openingBalance = $repository->openingBalanceTransaction($account); // put previous url in session if not redirect from store (not "return_to_edit"). - if (Session::get('accounts.edit.fromUpdate') !== true) { + if (session('accounts.edit.fromUpdate') !== true) { Session::put('accounts.edit.url', URL::previous()); } Session::forget('accounts.edit.fromUpdate'); @@ -154,8 +154,8 @@ class AccountController extends Controller $subTitleIcon = Config::get('firefly.subIconsByIdentifier.' . $what); $types = Config::get('firefly.accountTypesByIdentifier.' . $what); $accounts = $repository->getAccounts($types); - $start = clone Session::get('start', Carbon::now()->startOfMonth()); - $end = clone Session::get('end', Carbon::now()->endOfMonth()); + $start = clone session('start', Carbon::now()->startOfMonth()); + $end = clone session('end', Carbon::now()->endOfMonth()); $start->subDay(); $ids = $accounts->pluck('id')->toArray(); @@ -229,7 +229,7 @@ class AccountController extends Controller } // redirect to previous URL. - return redirect(Session::get('accounts.create.url')); + return redirect(session('accounts.create.url')); } /** @@ -268,7 +268,7 @@ class AccountController extends Controller } // redirect to previous URL. - return redirect(Session::get('accounts.edit.url')); + return redirect(session('accounts.edit.url')); } diff --git a/app/Http/Controllers/AttachmentController.php b/app/Http/Controllers/AttachmentController.php index 0e818f3f20..861d8c7062 100644 --- a/app/Http/Controllers/AttachmentController.php +++ b/app/Http/Controllers/AttachmentController.php @@ -65,7 +65,7 @@ class AttachmentController extends Controller Session::flash('success', trans('firefly.attachment_deleted', ['name' => $name])); Preferences::mark(); - return redirect(Session::get('attachments.delete.url')); + return redirect(session('attachments.delete.url')); } /** @@ -110,7 +110,7 @@ class AttachmentController extends Controller $subTitle = trans('firefly.edit_attachment', ['name' => $attachment->filename]); // put previous url in session if not redirect from store (not "return_to_edit"). - if (Session::get('attachments.edit.fromUpdate') !== true) { + if (session('attachments.edit.fromUpdate') !== true) { Session::put('attachments.edit.url', URL::previous()); } Session::forget('attachments.edit.fromUpdate'); @@ -167,7 +167,7 @@ class AttachmentController extends Controller } // redirect to previous URL. - return redirect(Session::get('attachments.edit.url')); + return redirect(session('attachments.edit.url')); } diff --git a/app/Http/Controllers/BillController.php b/app/Http/Controllers/BillController.php index ca59f0d256..e74da3c093 100644 --- a/app/Http/Controllers/BillController.php +++ b/app/Http/Controllers/BillController.php @@ -20,7 +20,7 @@ class BillController extends Controller { /** - * @codeCoverageIgnore + * */ public function __construct() { @@ -39,7 +39,7 @@ class BillController extends Controller // put previous url in session if not redirect from store (not "create another"). - if (Session::get('bills.create.fromStore') !== true) { + if (session('bills.create.fromStore') !== true) { Session::put('bills.create.url', URL::previous()); } Session::forget('bills.create.fromStore'); @@ -78,7 +78,7 @@ class BillController extends Controller Session::flash('success', 'The bill was deleted.'); Preferences::mark(); - return redirect(Session::get('bills.delete.url')); + return redirect(session('bills.delete.url')); } /** @@ -92,7 +92,7 @@ class BillController extends Controller $subTitle = trans('firefly.edit_bill', ['name' => $bill->name]); // put previous url in session if not redirect from store (not "return_to_edit"). - if (Session::get('bills.edit.fromUpdate') !== true) { + if (session('bills.edit.fromUpdate') !== true) { Session::put('bills.edit.url', URL::previous()); } Session::forget('bills.edit.fromUpdate'); @@ -184,7 +184,7 @@ class BillController extends Controller } // redirect to previous URL. - return redirect(Session::get('bills.create.url')); + return redirect(session('bills.create.url')); } @@ -211,7 +211,7 @@ class BillController extends Controller } // redirect to previous URL. - return redirect(Session::get('bills.edit.url')); + return redirect(session('bills.edit.url')); } diff --git a/app/Http/Controllers/BudgetController.php b/app/Http/Controllers/BudgetController.php index e86d95bb46..325f5a0352 100644 --- a/app/Http/Controllers/BudgetController.php +++ b/app/Http/Controllers/BudgetController.php @@ -26,7 +26,7 @@ class BudgetController extends Controller { /** - * @codeCoverageIgnore + * */ public function __construct() { @@ -45,7 +45,7 @@ class BudgetController extends Controller public function amount(BudgetRepositoryInterface $repository, Budget $budget) { $amount = intval(Input::get('amount')); - $date = Session::get('start', Carbon::now()->startOfMonth()); + $date = session('start', Carbon::now()->startOfMonth()); $limitRepetition = $repository->updateLimitAmount($budget, $date, $amount); if ($amount == 0) { $limitRepetition = null; @@ -62,7 +62,7 @@ class BudgetController extends Controller public function create() { // put previous url in session if not redirect from store (not "create another"). - if (Session::get('budgets.create.fromStore') !== true) { + if (session('budgets.create.fromStore') !== true) { Session::put('budgets.create.url', URL::previous()); } Session::forget('budgets.create.fromStore'); @@ -107,7 +107,7 @@ class BudgetController extends Controller Preferences::mark(); - return redirect(Session::get('budgets.delete.url')); + return redirect(session('budgets.delete.url')); } /** @@ -120,7 +120,7 @@ class BudgetController extends Controller $subTitle = trans('firefly.edit_budget', ['name' => $budget->name]); // put previous url in session if not redirect from store (not "return_to_edit"). - if (Session::get('budgets.edit.fromUpdate') !== true) { + if (session('budgets.edit.fromUpdate') !== true) { Session::put('budgets.edit.url', URL::previous()); } Session::forget('budgets.edit.fromUpdate'); @@ -145,7 +145,7 @@ class BudgetController extends Controller $spent = '0'; $budgeted = '0'; $range = Preferences::get('viewRange', '1M')->data; - $start = Navigation::startOfPeriod(Session::get('start', new Carbon), $range); + $start = Navigation::startOfPeriod(session('start', new Carbon), $range); $end = Navigation::endOfPeriod($start, $range); $key = 'budgetIncomeTotal' . $start->format('Ymd') . $end->format('Ymd'); $budgetIncomeTotal = Preferences::get($key, 1000)->data; @@ -187,7 +187,7 @@ class BudgetController extends Controller public function noBudget(BudgetRepositoryInterface $repository) { $range = Preferences::get('viewRange', '1M')->data; - $start = Navigation::startOfPeriod(Session::get('start', new Carbon), $range); + $start = Navigation::startOfPeriod(session('start', new Carbon), $range); $end = Navigation::endOfPeriod($start, $range); $list = $repository->getWithoutBudget($start, $end); $subTitle = trans( @@ -204,7 +204,7 @@ class BudgetController extends Controller public function postUpdateIncome() { $range = Preferences::get('viewRange', '1M')->data; - $start = Navigation::startOfPeriod(Session::get('start', new Carbon), $range); + $start = Navigation::startOfPeriod(session('start', new Carbon), $range); $end = Navigation::endOfPeriod($start, $range); $key = 'budgetIncomeTotal' . $start->format('Ymd') . $end->format('Ymd'); @@ -282,7 +282,7 @@ class BudgetController extends Controller } // redirect to previous URL. - return redirect(Session::get('budgets.create.url')); + return redirect(session('budgets.create.url')); } @@ -313,7 +313,7 @@ class BudgetController extends Controller } // redirect to previous URL. - return redirect(Session::get('budgets.edit.url')); + return redirect(session('budgets.edit.url')); } @@ -323,7 +323,7 @@ class BudgetController extends Controller public function updateIncome() { $range = Preferences::get('viewRange', '1M')->data; - $start = Navigation::startOfPeriod(Session::get('start', new Carbon), $range); + $start = Navigation::startOfPeriod(session('start', new Carbon), $range); $end = Navigation::endOfPeriod($start, $range); $key = 'budgetIncomeTotal' . $start->format('Ymd') . $end->format('Ymd'); $amount = Preferences::get($key, 1000); diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.php index 1b59519808..1a9f305b8e 100644 --- a/app/Http/Controllers/CategoryController.php +++ b/app/Http/Controllers/CategoryController.php @@ -25,7 +25,7 @@ class CategoryController extends Controller { /** - * @codeCoverageIgnore + * */ public function __construct() { @@ -40,7 +40,7 @@ class CategoryController extends Controller public function create() { // put previous url in session if not redirect from store (not "create another"). - if (Session::get('categories.create.fromStore') !== true) { + if (session('categories.create.fromStore') !== true) { Session::put('categories.create.url', URL::previous()); } Session::forget('categories.create.fromStore'); @@ -83,7 +83,7 @@ class CategoryController extends Controller Session::flash('success', 'The category "' . e($name) . '" was deleted.'); Preferences::mark(); - return redirect(Session::get('categories.delete.url')); + return redirect(session('categories.delete.url')); } /** @@ -96,7 +96,7 @@ class CategoryController extends Controller $subTitle = trans('firefly.edit_category', ['name' => $category->name]); // put previous url in session if not redirect from store (not "return_to_edit"). - if (Session::get('categories.edit.fromUpdate') !== true) { + if (session('categories.edit.fromUpdate') !== true) { Session::put('categories.edit.url', URL::previous()); } Session::forget('categories.edit.fromUpdate'); @@ -133,8 +133,8 @@ class CategoryController extends Controller */ public function noCategory(CRI $repository) { - $start = Session::get('start', Carbon::now()->startOfMonth()); - $end = Session::get('end', Carbon::now()->startOfMonth()); + $start = session('start', Carbon::now()->startOfMonth()); + $end = session('end', Carbon::now()->startOfMonth()); $list = $repository->listNoCategory($start, $end); $subTitle = trans( 'firefly.without_category_between', @@ -284,7 +284,7 @@ class CategoryController extends Controller } // redirect to previous URL. - return redirect(Session::get('categories.edit.url')); + return redirect(session('categories.edit.url')); } diff --git a/app/Http/Controllers/Chart/AccountController.php b/app/Http/Controllers/Chart/AccountController.php index 1110abaa27..6a5a3ea715 100644 --- a/app/Http/Controllers/Chart/AccountController.php +++ b/app/Http/Controllers/Chart/AccountController.php @@ -10,7 +10,6 @@ use FireflyIII\Support\CacheProperties; use Illuminate\Support\Collection; use Preferences; use Response; -use Session; /** * Class AccountController @@ -24,7 +23,7 @@ class AccountController extends Controller protected $generator; /** - * @codeCoverageIgnore + * */ public function __construct() { @@ -75,8 +74,8 @@ class AccountController extends Controller */ public function expenseAccounts(ARI $repository) { - $start = clone Session::get('start', Carbon::now()->startOfMonth()); - $end = clone Session::get('end', Carbon::now()->endOfMonth()); + $start = clone session('start', Carbon::now()->startOfMonth()); + $end = clone session('end', Carbon::now()->endOfMonth()); $accounts = $repository->getAccounts(['Expense account', 'Beneficiary account']); // chart properties for cache: @@ -106,8 +105,8 @@ class AccountController extends Controller public function frontpage(ARI $repository) { $frontPage = Preferences::get('frontPageAccounts', []); - $start = clone Session::get('start', Carbon::now()->startOfMonth()); - $end = clone Session::get('end', Carbon::now()->endOfMonth()); + $start = clone session('start', Carbon::now()->startOfMonth()); + $end = clone session('end', Carbon::now()->endOfMonth()); $accounts = $repository->getFrontpageAccounts($frontPage); // chart properties for cache: @@ -138,8 +137,8 @@ class AccountController extends Controller { - $start = Session::get('start', Carbon::now()->startOfMonth()); - $end = Session::get('end', Carbon::now()->endOfMonth()); + $start = session('start', Carbon::now()->startOfMonth()); + $end = session('end', Carbon::now()->endOfMonth()); // chart properties for cache: $cache = new CacheProperties(); diff --git a/app/Http/Controllers/Chart/BillController.php b/app/Http/Controllers/Chart/BillController.php index d1e58998c5..6772b4a4b6 100644 --- a/app/Http/Controllers/Chart/BillController.php +++ b/app/Http/Controllers/Chart/BillController.php @@ -9,7 +9,6 @@ use FireflyIII\Models\TransactionJournal; use FireflyIII\Repositories\Bill\BillRepositoryInterface; use FireflyIII\Support\CacheProperties; use Response; -use Session; /** * Class BillController @@ -23,7 +22,7 @@ class BillController extends Controller protected $generator; /** - * @codeCoverageIgnore + * */ public function __construct() { @@ -41,8 +40,8 @@ class BillController extends Controller */ public function frontpage(BillRepositoryInterface $repository) { - $start = Session::get('start', Carbon::now()->startOfMonth()); - $end = Session::get('end', Carbon::now()->endOfMonth()); + $start = session('start', Carbon::now()->startOfMonth()); + $end = session('end', Carbon::now()->endOfMonth()); $paid = $repository->getBillsPaidInRange($start, $end); // will be a negative amount. $unpaid = $repository->getBillsUnpaidInRange($start, $end); // will be a positive amount. $creditCardDue = $repository->getCreditCardBill($start, $end); diff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.php index 848a13179b..1677b2b817 100644 --- a/app/Http/Controllers/Chart/BudgetController.php +++ b/app/Http/Controllers/Chart/BudgetController.php @@ -13,7 +13,6 @@ use Illuminate\Support\Collection; use Navigation; use Preferences; use Response; -use Session; /** * Class BudgetController @@ -27,7 +26,7 @@ class BudgetController extends Controller protected $generator; /** - * @codeCoverageIgnore + * */ public function __construct() { @@ -129,7 +128,7 @@ class BudgetController extends Controller // dates and times $first = $repository->getFirstBudgetLimitDate($budget); $range = Preferences::get('viewRange', '1M')->data; - $last = Session::get('end', new Carbon); + $last = session('end', new Carbon); // chart properties for cache: $cache = new CacheProperties(); @@ -236,8 +235,8 @@ class BudgetController extends Controller */ public function frontpage(BudgetRepositoryInterface $repository, ARI $accountRepository) { - $start = Session::get('start', Carbon::now()->startOfMonth()); - $end = Session::get('end', Carbon::now()->endOfMonth()); + $start = session('start', Carbon::now()->startOfMonth()); + $end = session('end', Carbon::now()->endOfMonth()); // chart properties for cache: $cache = new CacheProperties(); diff --git a/app/Http/Controllers/Chart/CategoryController.php b/app/Http/Controllers/Chart/CategoryController.php index 95c1985206..e571535670 100644 --- a/app/Http/Controllers/Chart/CategoryController.php +++ b/app/Http/Controllers/Chart/CategoryController.php @@ -13,7 +13,6 @@ use Illuminate\Support\Collection; use Navigation; use Preferences; use Response; -use Session; use stdClass; /** @@ -27,7 +26,7 @@ class CategoryController extends Controller protected $generator; /** - * @codeCoverageIgnore + * */ public function __construct() { @@ -92,8 +91,8 @@ class CategoryController extends Controller */ public function currentPeriod(SCRI $repository, Category $category) { - $start = clone Session::get('start', Carbon::now()->startOfMonth()); - $end = Session::get('end', Carbon::now()->endOfMonth()); + $start = clone session('start', Carbon::now()->startOfMonth()); + $end = session('end', Carbon::now()->endOfMonth()); $data = $this->makePeriodChart($repository, $category, $start, $end); return Response::json($data); @@ -176,8 +175,8 @@ class CategoryController extends Controller public function frontpage(CRI $repository) { - $start = Session::get('start', Carbon::now()->startOfMonth()); - $end = Session::get('end', Carbon::now()->endOfMonth()); + $start = session('start', Carbon::now()->startOfMonth()); + $end = session('end', Carbon::now()->endOfMonth()); // chart properties for cache: $cache = new CacheProperties; @@ -395,7 +394,7 @@ class CategoryController extends Controller $cache->addProperty($category->id); $cache->addProperty('specific-period'); if ($cache->has()) { - return $cache->get(); // @codeCoverageIgnore + return $cache->get(); // } $entries = new Collection; diff --git a/app/Http/Controllers/CsvController.php b/app/Http/Controllers/CsvController.php index 75fa433460..24ef30c3ea 100644 --- a/app/Http/Controllers/CsvController.php +++ b/app/Http/Controllers/CsvController.php @@ -31,7 +31,7 @@ class CsvController extends Controller protected $wizard; /** - * @codeCoverageIgnore + * */ public function __construct() { @@ -106,21 +106,21 @@ class CsvController extends Controller return redirect(route('csv.index')); } $data = [ - 'date-format' => Session::get('csv-date-format'), - 'has-headers' => Session::get('csv-has-headers'), + 'date-format' => session('csv-date-format'), + 'has-headers' => session('csv-has-headers'), ]; if (Session::has('csv-map')) { - $data['map'] = Session::get('csv-map'); + $data['map'] = session('csv-map'); } if (Session::has('csv-roles')) { - $data['roles'] = Session::get('csv-roles'); + $data['roles'] = session('csv-roles'); } if (Session::has('csv-mapped')) { - $data['mapped'] = Session::get('csv-mapped'); + $data['mapped'] = session('csv-mapped'); } if (Session::has('csv-specifix')) { - $data['specifix'] = Session::get('csv-specifix'); + $data['specifix'] = session('csv-specifix'); } $result = json_encode($data, JSON_PRETTY_PRINT); diff --git a/app/Http/Controllers/CurrencyController.php b/app/Http/Controllers/CurrencyController.php index d62ba35cb1..80280c94ca 100644 --- a/app/Http/Controllers/CurrencyController.php +++ b/app/Http/Controllers/CurrencyController.php @@ -22,7 +22,7 @@ class CurrencyController extends Controller /** - * @codeCoverageIgnore + * */ public function __construct() { @@ -40,7 +40,7 @@ class CurrencyController extends Controller $subTitle = trans('firefly.create_currency'); // put previous url in session if not redirect from store (not "create another"). - if (Session::get('currency.create.fromStore') !== true) { + if (session('currency.create.fromStore') !== true) { Session::put('currency.create.url', URL::previous()); } Session::forget('currency.create.fromStore'); @@ -114,7 +114,7 @@ class CurrencyController extends Controller $currency->delete(); } - return redirect(Session::get('currency.delete.url')); + return redirect(session('currency.delete.url')); } /** @@ -129,7 +129,7 @@ class CurrencyController extends Controller $currency->symbol = htmlentities($currency->symbol); // put previous url in session if not redirect from store (not "return_to_edit"). - if (Session::get('currency.edit.fromUpdate') !== true) { + if (session('currency.edit.fromUpdate') !== true) { Session::put('currency.edit.url', URL::previous()); } Session::forget('currency.edit.fromUpdate'); @@ -183,7 +183,7 @@ class CurrencyController extends Controller } // redirect to previous URL. - return redirect(Session::get('currency.create.url')); + return redirect(session('currency.create.url')); } @@ -212,7 +212,7 @@ class CurrencyController extends Controller } // redirect to previous URL. - return redirect(Session::get('currency.edit.url')); + return redirect(session('currency.edit.url')); } diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 1d638813da..d4ada04d04 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -90,8 +90,8 @@ class HomeController extends Controller $mainTitleIcon = 'fa-fire'; $transactions = []; $frontPage = Preferences::get('frontPageAccounts', []); - $start = Session::get('start', Carbon::now()->startOfMonth()); - $end = Session::get('end', Carbon::now()->endOfMonth()); + $start = session('start', Carbon::now()->startOfMonth()); + $end = session('end', Carbon::now()->endOfMonth()); $showTour = Preferences::get('tour', true)->data; $accounts = $repository->getFrontpageAccounts($frontPage); $savings = $repository->getSavingsAccounts(); diff --git a/app/Http/Controllers/JsonController.php b/app/Http/Controllers/JsonController.php index 682299f4d3..fab1453a10 100644 --- a/app/Http/Controllers/JsonController.php +++ b/app/Http/Controllers/JsonController.php @@ -13,7 +13,6 @@ use FireflyIII\Support\CacheProperties; use Input; use Preferences; use Response; -use Session; /** * Class JsonController @@ -24,8 +23,6 @@ class JsonController extends Controller { /** * JsonController constructor. - * - * @codeCoverageIgnore */ public function __construct() { @@ -56,8 +53,8 @@ class JsonController extends Controller */ public function boxBillsPaid(BillRepositoryInterface $repository) { - $start = Session::get('start', Carbon::now()->startOfMonth()); - $end = Session::get('end', Carbon::now()->endOfMonth()); + $start = session('start', Carbon::now()->startOfMonth()); + $end = session('end', Carbon::now()->endOfMonth()); bcscale(2); /* @@ -84,8 +81,8 @@ class JsonController extends Controller public function boxBillsUnpaid(BillRepositoryInterface $repository) { bcscale(2); - $start = Session::get('start', Carbon::now()->startOfMonth()); - $end = Session::get('end', Carbon::now()->endOfMonth()); + $start = session('start', Carbon::now()->startOfMonth()); + $end = session('end', Carbon::now()->endOfMonth()); $amount = $repository->getBillsUnpaidInRange($start, $end); // will be a positive amount. $creditCardDue = $repository->getCreditCardBill($start, $end); @@ -109,8 +106,8 @@ class JsonController extends Controller */ public function boxIn(ReportQueryInterface $reportQuery, ARI $accountRepository) { - $start = Session::get('start', Carbon::now()->startOfMonth()); - $end = Session::get('end', Carbon::now()->endOfMonth()); + $start = session('start', Carbon::now()->startOfMonth()); + $end = session('end', Carbon::now()->endOfMonth()); // works for json too! $cache = new CacheProperties; @@ -138,8 +135,8 @@ class JsonController extends Controller */ public function boxOut(ReportQueryInterface $reportQuery, ARI $accountRepository) { - $start = Session::get('start', Carbon::now()->startOfMonth()); - $end = Session::get('end', Carbon::now()->endOfMonth()); + $start = session('start', Carbon::now()->startOfMonth()); + $end = session('end', Carbon::now()->endOfMonth()); $accounts = $accountRepository->getAccounts(['Default account', 'Asset account', 'Cash account']); diff --git a/app/Http/Controllers/PiggyBankController.php b/app/Http/Controllers/PiggyBankController.php index 56ea5322ab..56ec30ceac 100644 --- a/app/Http/Controllers/PiggyBankController.php +++ b/app/Http/Controllers/PiggyBankController.php @@ -28,7 +28,7 @@ class PiggyBankController extends Controller { /** - * @codeCoverageIgnore + * */ public function __construct() { @@ -48,7 +48,7 @@ class PiggyBankController extends Controller public function add(ARI $repository, PiggyBank $piggyBank) { bcscale(2); - $date = Session::get('end', Carbon::now()->endOfMonth()); + $date = session('end', Carbon::now()->endOfMonth()); $leftOnAccount = $repository->leftOnAccount($piggyBank->account, $date); $savedSoFar = $piggyBank->currentRelevantRep()->currentamount; $leftToSave = bcsub($piggyBank->targetamount, $savedSoFar); @@ -71,7 +71,7 @@ class PiggyBankController extends Controller $subTitleIcon = 'fa-plus'; // put previous url in session if not redirect from store (not "create another"). - if (Session::get('piggy-banks.create.fromStore') !== true) { + if (session('piggy-banks.create.fromStore') !== true) { Session::put('piggy-banks.create.url', URL::previous()); } Session::forget('piggy-banks.create.fromStore'); @@ -112,7 +112,7 @@ class PiggyBankController extends Controller Preferences::mark(); $repository->destroy($piggyBank); - return redirect(Session::get('piggy-banks.delete.url')); + return redirect(session('piggy-banks.delete.url')); } /** @@ -148,7 +148,7 @@ class PiggyBankController extends Controller Session::flash('gaEventAction', 'edit'); // put previous url in session if not redirect from store (not "return_to_edit"). - if (Session::get('piggy-banks.edit.fromUpdate') !== true) { + if (session('piggy-banks.edit.fromUpdate') !== true) { Session::put('piggy-banks.edit.url', URL::previous()); } Session::forget('piggy-banks.edit.fromUpdate'); @@ -166,7 +166,7 @@ class PiggyBankController extends Controller { /** @var Collection $piggyBanks */ $piggyBanks = $piggyRepository->getPiggyBanks(); - $end = Session::get('end', Carbon::now()->endOfMonth()); + $end = session('end', Carbon::now()->endOfMonth()); bcscale(2); $accounts = []; @@ -228,7 +228,7 @@ class PiggyBankController extends Controller { bcscale(2); $amount = round(Input::get('amount'), 2); - $date = Session::get('end', Carbon::now()->endOfMonth()); + $date = session('end', Carbon::now()->endOfMonth()); $leftOnAccount = $accounts->leftOnAccount($piggyBank->account, $date); $savedSoFar = $piggyBank->currentRelevantRep()->currentamount; $leftToSave = bcsub($piggyBank->targetamount, $savedSoFar); @@ -341,7 +341,7 @@ class PiggyBankController extends Controller // redirect to previous URL. - return redirect(Session::get('piggy-banks.create.url')); + return redirect(session('piggy-banks.create.url')); } /** @@ -376,7 +376,7 @@ class PiggyBankController extends Controller // redirect to previous URL. - return redirect(Session::get('piggy-banks.edit.url')); + return redirect(session('piggy-banks.edit.url')); } diff --git a/app/Http/Controllers/RuleController.php b/app/Http/Controllers/RuleController.php index bafd1d793d..22fc883e94 100644 --- a/app/Http/Controllers/RuleController.php +++ b/app/Http/Controllers/RuleController.php @@ -72,7 +72,7 @@ class RuleController extends Controller $subTitle = trans('firefly.make_new_rule', ['title' => $ruleGroup->title]); // put previous url in session if not redirect from store (not "create another"). - if (Session::get('rules.rule.create.fromStore') !== true) { + if (session('rules.rule.create.fromStore') !== true) { Session::put('rules.rule.create.url', URL::previous()); } Session::forget('rules.rule.create.fromStore'); @@ -118,7 +118,7 @@ class RuleController extends Controller Preferences::mark(); - return redirect(Session::get('rules.rule.delete.url')); + return redirect(session('rules.rule.delete.url')); } /** @@ -160,7 +160,7 @@ class RuleController extends Controller $subTitle = trans('firefly.edit_rule', ['title' => $rule->title]); // put previous url in session if not redirect from store (not "return_to_edit"). - if (Session::get('rules.rule.edit.fromUpdate') !== true) { + if (session('rules.rule.edit.fromUpdate') !== true) { Session::put('rules.rule.edit.url', URL::previous()); } Session::forget('rules.rule.edit.fromUpdate'); @@ -274,7 +274,7 @@ class RuleController extends Controller } // redirect to previous URL. - return redirect(Session::get('rules.rule.create.url')); + return redirect(session('rules.rule.create.url')); } @@ -329,7 +329,7 @@ class RuleController extends Controller } // redirect to previous URL. - return redirect(Session::get('rules.rule.edit.url')); + return redirect(session('rules.rule.edit.url')); } private function createDefaultRule() diff --git a/app/Http/Controllers/RuleGroupController.php b/app/Http/Controllers/RuleGroupController.php index 375a42666e..8e436645d8 100644 --- a/app/Http/Controllers/RuleGroupController.php +++ b/app/Http/Controllers/RuleGroupController.php @@ -39,7 +39,7 @@ class RuleGroupController extends Controller $subTitle = trans('firefly.make_new_rule_group'); // put previous url in session if not redirect from store (not "create another"). - if (Session::get('rules.rule-group.create.fromStore') !== true) { + if (session('rules.rule-group.create.fromStore') !== true) { Session::put('rules.rule-group.create.url', URL::previous()); } Session::forget('rules.rule-group.create.fromStore'); @@ -90,7 +90,7 @@ class RuleGroupController extends Controller Preferences::mark(); - return redirect(Session::get('rules.rule-group.delete.url')); + return redirect(session('rules.rule-group.delete.url')); } /** @@ -117,7 +117,7 @@ class RuleGroupController extends Controller $subTitle = trans('firefly.edit_rule_group', ['title' => $ruleGroup->title]); // put previous url in session if not redirect from store (not "return_to_edit"). - if (Session::get('rules.rule-group.edit.fromUpdate') !== true) { + if (session('rules.rule-group.edit.fromUpdate') !== true) { Session::put('rules.rule-group.edit.url', URL::previous()); } Session::forget('rules.rule-group.edit.fromUpdate'); @@ -155,7 +155,7 @@ class RuleGroupController extends Controller } // redirect to previous URL. - return redirect(Session::get('rules.rule-group.create.url')); + return redirect(session('rules.rule-group.create.url')); } /** @@ -200,7 +200,7 @@ class RuleGroupController extends Controller } // redirect to previous URL. - return redirect(Session::get('rules.rule-group.edit.url')); + return redirect(session('rules.rule-group.edit.url')); } diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.php index bdd0c6bab5..be29b9ec53 100644 --- a/app/Http/Controllers/TagController.php +++ b/app/Http/Controllers/TagController.php @@ -35,7 +35,7 @@ class TagController extends Controller public $tagOptions = []; /** - * @codeCoverageIgnore + * */ public function __construct() { @@ -66,7 +66,7 @@ class TagController extends Controller Session::flash('preFilled', $preFilled); } // put previous url in session if not redirect from store (not "create another"). - if (Session::get('tags.create.fromStore') !== true) { + if (session('tags.create.fromStore') !== true) { Session::put('tags.create.url', URL::previous()); } Session::forget('tags.create.fromStore'); @@ -144,7 +144,7 @@ class TagController extends Controller // put previous url in session if not redirect from store (not "return_to_edit"). - if (Session::get('tags.edit.fromUpdate') !== true) { + if (session('tags.edit.fromUpdate') !== true) { Session::put('tags.edit.url', URL::previous()); } Session::forget('tags.edit.fromUpdate'); @@ -264,7 +264,7 @@ class TagController extends Controller } // redirect to previous URL. - return redirect(Session::get('tags.create.url')); + return redirect(session('tags.create.url')); } @@ -311,6 +311,6 @@ class TagController extends Controller } // redirect to previous URL. - return redirect(Session::get('tags.edit.url')); + return redirect(session('tags.edit.url')); } } diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.php index 41b0a4975f..e8b92dadba 100644 --- a/app/Http/Controllers/TransactionController.php +++ b/app/Http/Controllers/TransactionController.php @@ -34,7 +34,7 @@ use View; class TransactionController extends Controller { /** - * @codeCoverageIgnore + * */ public function __construct() { @@ -66,7 +66,7 @@ class TransactionController extends Controller $piggies = ExpandedForm::makeSelectList($piggyBanks); $piggies[0] = trans('form.noPiggybank'); - $preFilled = Session::has('preFilled') ? Session::get('preFilled') : []; + $preFilled = Session::has('preFilled') ? session('preFilled') : []; $respondTo = ['account_id', 'account_from_id']; $subTitle = trans('form.add_new_' . $what); @@ -76,7 +76,7 @@ class TransactionController extends Controller Session::put('preFilled', $preFilled); // put previous url in session if not redirect from store (not "create another"). - if (Session::get('transactions.create.fromStore') !== true) { + if (session('transactions.create.fromStore') !== true) { Session::put('transactions.create.url', URL::previous()); } Session::forget('transactions.create.fromStore'); @@ -126,7 +126,7 @@ class TransactionController extends Controller Preferences::mark(); // redirect to previous URL: - return redirect(Session::get('transactions.delete.url')); + return redirect(session('transactions.delete.url')); } /** @@ -196,7 +196,7 @@ class TransactionController extends Controller Session::flash('gaEventAction', 'edit-' . $what); // put previous url in session if not redirect from store (not "return_to_edit"). - if (Session::get('transactions.edit.fromUpdate') !== true) { + if (session('transactions.edit.fromUpdate') !== true) { Session::put('transactions.edit.url', URL::previous()); } Session::forget('transactions.edit.fromUpdate'); @@ -327,7 +327,7 @@ class TransactionController extends Controller } // redirect to previous URL. - return redirect(Session::get('transactions.create.url')); + return redirect(session('transactions.create.url')); } @@ -372,7 +372,7 @@ class TransactionController extends Controller } // redirect to previous URL. - return redirect(Session::get('transactions.edit.url')); + return redirect(session('transactions.edit.url')); } diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php index 996ba8ca59..ea19ac2dc2 100644 --- a/app/Repositories/Account/AccountRepository.php +++ b/app/Repositories/Account/AccountRepository.php @@ -18,7 +18,6 @@ use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Support\Collection; use Log; -use Session; use Steam; @@ -225,8 +224,8 @@ class AccountRepository implements AccountRepositoryInterface */ public function getPiggyBankAccounts() { - $start = clone Session::get('start', new Carbon); - $end = clone Session::get('end', new Carbon); + $start = clone session('start', new Carbon); + $end = clone session('end', new Carbon); $collection = new Collection(DB::table('piggy_banks')->distinct()->get(['piggy_banks.account_id'])); $ids = $collection->pluck('account_id')->toArray(); $accounts = new Collection; @@ -273,8 +272,8 @@ class AccountRepository implements AccountRepositoryInterface ->where('accounts.active', 1) ->where('account_meta.data', '"savingAsset"') ->get(['accounts.*']); - $start = clone Session::get('start', new Carbon); - $end = clone Session::get('end', new Carbon); + $start = clone session('start', new Carbon); + $end = clone session('end', new Carbon); bcscale(2); diff --git a/app/Support/ExpandedForm.php b/app/Support/ExpandedForm.php index 2fe9edcd3e..302e26aaa6 100644 --- a/app/Support/ExpandedForm.php +++ b/app/Support/ExpandedForm.php @@ -387,7 +387,7 @@ class ExpandedForm protected function fillFieldValue($name, $value) { if (Session::has('preFilled')) { - $preFilled = Session::get('preFilled'); + $preFilled = session('preFilled'); $value = isset($preFilled[$name]) && is_null($value) ? $preFilled[$name] : $value; } // @codeCoverageIgnoreStart @@ -415,7 +415,7 @@ class ExpandedForm * Get errors from session: */ /** @var MessageBag $errors */ - $errors = Session::get('errors'); + $errors = session('errors'); $classes = 'form-group'; if (!is_null($errors) && $errors->has($name)) { diff --git a/app/Support/Twig/General.php b/app/Support/Twig/General.php index 4534c3f86b..c95751acf8 100644 --- a/app/Support/Twig/General.php +++ b/app/Support/Twig/General.php @@ -7,7 +7,6 @@ use Config; use FireflyIII\Models\Account; use FireflyIII\Models\Transaction; use Route; -use Session; use Twig_Extension; use Twig_SimpleFilter; use Twig_SimpleFunction; @@ -169,7 +168,7 @@ class General extends Twig_Extension if (is_null($account)) { return 'NULL'; } - $date = Session::get('end', Carbon::now()->endOfMonth()); + $date = session('end', Carbon::now()->endOfMonth()); return app('steam')->balance($account, $date); }