Replaced Session::get() with session()

This commit is contained in:
James Cole
2016-02-04 07:27:03 +01:00
parent bd40615f8e
commit c1ecc62ac1
23 changed files with 126 additions and 136 deletions

View File

@@ -6,7 +6,6 @@ use Carbon\Carbon;
use FireflyIII\Exceptions\FireflyException; use FireflyIII\Exceptions\FireflyException;
use InvalidArgumentException; use InvalidArgumentException;
use Log; use Log;
use Session;
/** /**
* Class Date * Class Date
@@ -22,7 +21,7 @@ class Date extends BasicConverter implements ConverterInterface
*/ */
public function convert() public function convert()
{ {
$format = Session::get('csv-date-format'); $format = session('csv-date-format');
try { try {
$date = Carbon::createFromFormat($format, $this->value); $date = Carbon::createFromFormat($format, $this->value);
} catch (InvalidArgumentException $e) { } catch (InvalidArgumentException $e) {

View File

@@ -260,63 +260,63 @@ class Data
protected function sessionCsvFileLocation() protected function sessionCsvFileLocation()
{ {
if (Session::has('csv-file')) { if (Session::has('csv-file')) {
$this->csvFileLocation = (string)Session::get('csv-file'); $this->csvFileLocation = (string)session('csv-file');
} }
} }
protected function sessionDateFormat() protected function sessionDateFormat()
{ {
if (Session::has('csv-date-format')) { if (Session::has('csv-date-format')) {
$this->dateFormat = (string)Session::get('csv-date-format'); $this->dateFormat = (string)session('csv-date-format');
} }
} }
protected function sessionDelimiter() protected function sessionDelimiter()
{ {
if (Session::has('csv-delimiter')) { if (Session::has('csv-delimiter')) {
$this->delimiter = Session::get('csv-delimiter'); $this->delimiter = session('csv-delimiter');
} }
} }
protected function sessionHasHeaders() protected function sessionHasHeaders()
{ {
if (Session::has('csv-has-headers')) { if (Session::has('csv-has-headers')) {
$this->hasHeaders = (bool)Session::get('csv-has-headers'); $this->hasHeaders = (bool)session('csv-has-headers');
} }
} }
protected function sessionImportAccount() protected function sessionImportAccount()
{ {
if (Session::has('csv-import-account')) { if (Session::has('csv-import-account')) {
$this->importAccount = intval(Session::get('csv-import-account')); $this->importAccount = intval(session('csv-import-account'));
} }
} }
protected function sessionMap() protected function sessionMap()
{ {
if (Session::has('csv-map')) { if (Session::has('csv-map')) {
$this->map = (array)Session::get('csv-map'); $this->map = (array)session('csv-map');
} }
} }
protected function sessionMapped() protected function sessionMapped()
{ {
if (Session::has('csv-mapped')) { if (Session::has('csv-mapped')) {
$this->mapped = (array)Session::get('csv-mapped'); $this->mapped = (array)session('csv-mapped');
} }
} }
protected function sessionRoles() protected function sessionRoles()
{ {
if (Session::has('csv-roles')) { if (Session::has('csv-roles')) {
$this->roles = (array)Session::get('csv-roles'); $this->roles = (array)session('csv-roles');
} }
} }
protected function sessionSpecifix() protected function sessionSpecifix()
{ {
if (Session::has('csv-specifix')) { if (Session::has('csv-specifix')) {
$this->specifix = (array)Session::get('csv-specifix'); $this->specifix = (array)session('csv-specifix');
} }
} }
} }

View File

@@ -22,7 +22,7 @@ use View;
class AccountController extends Controller class AccountController extends Controller
{ {
/** /**
* @codeCoverageIgnore *
*/ */
public function __construct() public function __construct()
{ {
@@ -44,7 +44,7 @@ class AccountController extends Controller
$subTitle = trans('firefly.make_new_' . $what . '_account'); $subTitle = trans('firefly.make_new_' . $what . '_account');
// put previous url in session if not redirect from store (not "create another"). // 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::put('accounts.create.url', URL::previous());
} }
Session::forget('accounts.create.fromStore'); Session::forget('accounts.create.fromStore');
@@ -94,7 +94,7 @@ class AccountController extends Controller
Session::flash('success', trans('firefly.' . $typeName . '_deleted', ['name' => $name])); Session::flash('success', trans('firefly.' . $typeName . '_deleted', ['name' => $name]));
Preferences::mark(); 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); $openingBalance = $repository->openingBalanceTransaction($account);
// put previous url in session if not redirect from store (not "return_to_edit"). // 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::put('accounts.edit.url', URL::previous());
} }
Session::forget('accounts.edit.fromUpdate'); Session::forget('accounts.edit.fromUpdate');
@@ -154,8 +154,8 @@ class AccountController extends Controller
$subTitleIcon = Config::get('firefly.subIconsByIdentifier.' . $what); $subTitleIcon = Config::get('firefly.subIconsByIdentifier.' . $what);
$types = Config::get('firefly.accountTypesByIdentifier.' . $what); $types = Config::get('firefly.accountTypesByIdentifier.' . $what);
$accounts = $repository->getAccounts($types); $accounts = $repository->getAccounts($types);
$start = clone Session::get('start', Carbon::now()->startOfMonth()); $start = clone session('start', Carbon::now()->startOfMonth());
$end = clone Session::get('end', Carbon::now()->endOfMonth()); $end = clone session('end', Carbon::now()->endOfMonth());
$start->subDay(); $start->subDay();
$ids = $accounts->pluck('id')->toArray(); $ids = $accounts->pluck('id')->toArray();
@@ -229,7 +229,7 @@ class AccountController extends Controller
} }
// redirect to previous URL. // 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. // redirect to previous URL.
return redirect(Session::get('accounts.edit.url')); return redirect(session('accounts.edit.url'));
} }

View File

@@ -65,7 +65,7 @@ class AttachmentController extends Controller
Session::flash('success', trans('firefly.attachment_deleted', ['name' => $name])); Session::flash('success', trans('firefly.attachment_deleted', ['name' => $name]));
Preferences::mark(); 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]); $subTitle = trans('firefly.edit_attachment', ['name' => $attachment->filename]);
// put previous url in session if not redirect from store (not "return_to_edit"). // 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::put('attachments.edit.url', URL::previous());
} }
Session::forget('attachments.edit.fromUpdate'); Session::forget('attachments.edit.fromUpdate');
@@ -167,7 +167,7 @@ class AttachmentController extends Controller
} }
// redirect to previous URL. // redirect to previous URL.
return redirect(Session::get('attachments.edit.url')); return redirect(session('attachments.edit.url'));
} }

View File

@@ -20,7 +20,7 @@ class BillController extends Controller
{ {
/** /**
* @codeCoverageIgnore *
*/ */
public function __construct() public function __construct()
{ {
@@ -39,7 +39,7 @@ class BillController extends Controller
// put previous url in session if not redirect from store (not "create another"). // 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::put('bills.create.url', URL::previous());
} }
Session::forget('bills.create.fromStore'); Session::forget('bills.create.fromStore');
@@ -78,7 +78,7 @@ class BillController extends Controller
Session::flash('success', 'The bill was deleted.'); Session::flash('success', 'The bill was deleted.');
Preferences::mark(); 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]); $subTitle = trans('firefly.edit_bill', ['name' => $bill->name]);
// put previous url in session if not redirect from store (not "return_to_edit"). // 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::put('bills.edit.url', URL::previous());
} }
Session::forget('bills.edit.fromUpdate'); Session::forget('bills.edit.fromUpdate');
@@ -184,7 +184,7 @@ class BillController extends Controller
} }
// redirect to previous URL. // 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. // redirect to previous URL.
return redirect(Session::get('bills.edit.url')); return redirect(session('bills.edit.url'));
} }

View File

@@ -26,7 +26,7 @@ class BudgetController extends Controller
{ {
/** /**
* @codeCoverageIgnore *
*/ */
public function __construct() public function __construct()
{ {
@@ -45,7 +45,7 @@ class BudgetController extends Controller
public function amount(BudgetRepositoryInterface $repository, Budget $budget) public function amount(BudgetRepositoryInterface $repository, Budget $budget)
{ {
$amount = intval(Input::get('amount')); $amount = intval(Input::get('amount'));
$date = Session::get('start', Carbon::now()->startOfMonth()); $date = session('start', Carbon::now()->startOfMonth());
$limitRepetition = $repository->updateLimitAmount($budget, $date, $amount); $limitRepetition = $repository->updateLimitAmount($budget, $date, $amount);
if ($amount == 0) { if ($amount == 0) {
$limitRepetition = null; $limitRepetition = null;
@@ -62,7 +62,7 @@ class BudgetController extends Controller
public function create() public function create()
{ {
// put previous url in session if not redirect from store (not "create another"). // 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::put('budgets.create.url', URL::previous());
} }
Session::forget('budgets.create.fromStore'); Session::forget('budgets.create.fromStore');
@@ -107,7 +107,7 @@ class BudgetController extends Controller
Preferences::mark(); 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]); $subTitle = trans('firefly.edit_budget', ['name' => $budget->name]);
// put previous url in session if not redirect from store (not "return_to_edit"). // 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::put('budgets.edit.url', URL::previous());
} }
Session::forget('budgets.edit.fromUpdate'); Session::forget('budgets.edit.fromUpdate');
@@ -145,7 +145,7 @@ class BudgetController extends Controller
$spent = '0'; $spent = '0';
$budgeted = '0'; $budgeted = '0';
$range = Preferences::get('viewRange', '1M')->data; $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); $end = Navigation::endOfPeriod($start, $range);
$key = 'budgetIncomeTotal' . $start->format('Ymd') . $end->format('Ymd'); $key = 'budgetIncomeTotal' . $start->format('Ymd') . $end->format('Ymd');
$budgetIncomeTotal = Preferences::get($key, 1000)->data; $budgetIncomeTotal = Preferences::get($key, 1000)->data;
@@ -187,7 +187,7 @@ class BudgetController extends Controller
public function noBudget(BudgetRepositoryInterface $repository) public function noBudget(BudgetRepositoryInterface $repository)
{ {
$range = Preferences::get('viewRange', '1M')->data; $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); $end = Navigation::endOfPeriod($start, $range);
$list = $repository->getWithoutBudget($start, $end); $list = $repository->getWithoutBudget($start, $end);
$subTitle = trans( $subTitle = trans(
@@ -204,7 +204,7 @@ class BudgetController extends Controller
public function postUpdateIncome() public function postUpdateIncome()
{ {
$range = Preferences::get('viewRange', '1M')->data; $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); $end = Navigation::endOfPeriod($start, $range);
$key = 'budgetIncomeTotal' . $start->format('Ymd') . $end->format('Ymd'); $key = 'budgetIncomeTotal' . $start->format('Ymd') . $end->format('Ymd');
@@ -282,7 +282,7 @@ class BudgetController extends Controller
} }
// redirect to previous URL. // 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. // 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() public function updateIncome()
{ {
$range = Preferences::get('viewRange', '1M')->data; $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); $end = Navigation::endOfPeriod($start, $range);
$key = 'budgetIncomeTotal' . $start->format('Ymd') . $end->format('Ymd'); $key = 'budgetIncomeTotal' . $start->format('Ymd') . $end->format('Ymd');
$amount = Preferences::get($key, 1000); $amount = Preferences::get($key, 1000);

View File

@@ -25,7 +25,7 @@ class CategoryController extends Controller
{ {
/** /**
* @codeCoverageIgnore *
*/ */
public function __construct() public function __construct()
{ {
@@ -40,7 +40,7 @@ class CategoryController extends Controller
public function create() public function create()
{ {
// put previous url in session if not redirect from store (not "create another"). // 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::put('categories.create.url', URL::previous());
} }
Session::forget('categories.create.fromStore'); Session::forget('categories.create.fromStore');
@@ -83,7 +83,7 @@ class CategoryController extends Controller
Session::flash('success', 'The category "' . e($name) . '" was deleted.'); Session::flash('success', 'The category "' . e($name) . '" was deleted.');
Preferences::mark(); 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]); $subTitle = trans('firefly.edit_category', ['name' => $category->name]);
// put previous url in session if not redirect from store (not "return_to_edit"). // 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::put('categories.edit.url', URL::previous());
} }
Session::forget('categories.edit.fromUpdate'); Session::forget('categories.edit.fromUpdate');
@@ -133,8 +133,8 @@ class CategoryController extends Controller
*/ */
public function noCategory(CRI $repository) public function noCategory(CRI $repository)
{ {
$start = Session::get('start', Carbon::now()->startOfMonth()); $start = session('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->startOfMonth()); $end = session('end', Carbon::now()->startOfMonth());
$list = $repository->listNoCategory($start, $end); $list = $repository->listNoCategory($start, $end);
$subTitle = trans( $subTitle = trans(
'firefly.without_category_between', 'firefly.without_category_between',
@@ -284,7 +284,7 @@ class CategoryController extends Controller
} }
// redirect to previous URL. // redirect to previous URL.
return redirect(Session::get('categories.edit.url')); return redirect(session('categories.edit.url'));
} }

View File

@@ -10,7 +10,6 @@ use FireflyIII\Support\CacheProperties;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Preferences; use Preferences;
use Response; use Response;
use Session;
/** /**
* Class AccountController * Class AccountController
@@ -24,7 +23,7 @@ class AccountController extends Controller
protected $generator; protected $generator;
/** /**
* @codeCoverageIgnore *
*/ */
public function __construct() public function __construct()
{ {
@@ -75,8 +74,8 @@ class AccountController extends Controller
*/ */
public function expenseAccounts(ARI $repository) public function expenseAccounts(ARI $repository)
{ {
$start = clone Session::get('start', Carbon::now()->startOfMonth()); $start = clone session('start', Carbon::now()->startOfMonth());
$end = clone Session::get('end', Carbon::now()->endOfMonth()); $end = clone session('end', Carbon::now()->endOfMonth());
$accounts = $repository->getAccounts(['Expense account', 'Beneficiary account']); $accounts = $repository->getAccounts(['Expense account', 'Beneficiary account']);
// chart properties for cache: // chart properties for cache:
@@ -106,8 +105,8 @@ class AccountController extends Controller
public function frontpage(ARI $repository) public function frontpage(ARI $repository)
{ {
$frontPage = Preferences::get('frontPageAccounts', []); $frontPage = Preferences::get('frontPageAccounts', []);
$start = clone Session::get('start', Carbon::now()->startOfMonth()); $start = clone session('start', Carbon::now()->startOfMonth());
$end = clone Session::get('end', Carbon::now()->endOfMonth()); $end = clone session('end', Carbon::now()->endOfMonth());
$accounts = $repository->getFrontpageAccounts($frontPage); $accounts = $repository->getFrontpageAccounts($frontPage);
// chart properties for cache: // chart properties for cache:
@@ -138,8 +137,8 @@ class AccountController extends Controller
{ {
$start = Session::get('start', Carbon::now()->startOfMonth()); $start = session('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->endOfMonth()); $end = session('end', Carbon::now()->endOfMonth());
// chart properties for cache: // chart properties for cache:
$cache = new CacheProperties(); $cache = new CacheProperties();

View File

@@ -9,7 +9,6 @@ use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Bill\BillRepositoryInterface; use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use FireflyIII\Support\CacheProperties; use FireflyIII\Support\CacheProperties;
use Response; use Response;
use Session;
/** /**
* Class BillController * Class BillController
@@ -23,7 +22,7 @@ class BillController extends Controller
protected $generator; protected $generator;
/** /**
* @codeCoverageIgnore *
*/ */
public function __construct() public function __construct()
{ {
@@ -41,8 +40,8 @@ class BillController extends Controller
*/ */
public function frontpage(BillRepositoryInterface $repository) public function frontpage(BillRepositoryInterface $repository)
{ {
$start = Session::get('start', Carbon::now()->startOfMonth()); $start = session('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->endOfMonth()); $end = session('end', Carbon::now()->endOfMonth());
$paid = $repository->getBillsPaidInRange($start, $end); // will be a negative amount. $paid = $repository->getBillsPaidInRange($start, $end); // will be a negative amount.
$unpaid = $repository->getBillsUnpaidInRange($start, $end); // will be a positive amount. $unpaid = $repository->getBillsUnpaidInRange($start, $end); // will be a positive amount.
$creditCardDue = $repository->getCreditCardBill($start, $end); $creditCardDue = $repository->getCreditCardBill($start, $end);

View File

@@ -13,7 +13,6 @@ use Illuminate\Support\Collection;
use Navigation; use Navigation;
use Preferences; use Preferences;
use Response; use Response;
use Session;
/** /**
* Class BudgetController * Class BudgetController
@@ -27,7 +26,7 @@ class BudgetController extends Controller
protected $generator; protected $generator;
/** /**
* @codeCoverageIgnore *
*/ */
public function __construct() public function __construct()
{ {
@@ -129,7 +128,7 @@ class BudgetController extends Controller
// dates and times // dates and times
$first = $repository->getFirstBudgetLimitDate($budget); $first = $repository->getFirstBudgetLimitDate($budget);
$range = Preferences::get('viewRange', '1M')->data; $range = Preferences::get('viewRange', '1M')->data;
$last = Session::get('end', new Carbon); $last = session('end', new Carbon);
// chart properties for cache: // chart properties for cache:
$cache = new CacheProperties(); $cache = new CacheProperties();
@@ -236,8 +235,8 @@ class BudgetController extends Controller
*/ */
public function frontpage(BudgetRepositoryInterface $repository, ARI $accountRepository) public function frontpage(BudgetRepositoryInterface $repository, ARI $accountRepository)
{ {
$start = Session::get('start', Carbon::now()->startOfMonth()); $start = session('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->endOfMonth()); $end = session('end', Carbon::now()->endOfMonth());
// chart properties for cache: // chart properties for cache:
$cache = new CacheProperties(); $cache = new CacheProperties();

View File

@@ -13,7 +13,6 @@ use Illuminate\Support\Collection;
use Navigation; use Navigation;
use Preferences; use Preferences;
use Response; use Response;
use Session;
use stdClass; use stdClass;
/** /**
@@ -27,7 +26,7 @@ class CategoryController extends Controller
protected $generator; protected $generator;
/** /**
* @codeCoverageIgnore *
*/ */
public function __construct() public function __construct()
{ {
@@ -92,8 +91,8 @@ class CategoryController extends Controller
*/ */
public function currentPeriod(SCRI $repository, Category $category) public function currentPeriod(SCRI $repository, Category $category)
{ {
$start = clone Session::get('start', Carbon::now()->startOfMonth()); $start = clone session('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->endOfMonth()); $end = session('end', Carbon::now()->endOfMonth());
$data = $this->makePeriodChart($repository, $category, $start, $end); $data = $this->makePeriodChart($repository, $category, $start, $end);
return Response::json($data); return Response::json($data);
@@ -176,8 +175,8 @@ class CategoryController extends Controller
public function frontpage(CRI $repository) public function frontpage(CRI $repository)
{ {
$start = Session::get('start', Carbon::now()->startOfMonth()); $start = session('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->endOfMonth()); $end = session('end', Carbon::now()->endOfMonth());
// chart properties for cache: // chart properties for cache:
$cache = new CacheProperties; $cache = new CacheProperties;
@@ -395,7 +394,7 @@ class CategoryController extends Controller
$cache->addProperty($category->id); $cache->addProperty($category->id);
$cache->addProperty('specific-period'); $cache->addProperty('specific-period');
if ($cache->has()) { if ($cache->has()) {
return $cache->get(); // @codeCoverageIgnore return $cache->get(); //
} }
$entries = new Collection; $entries = new Collection;

View File

@@ -31,7 +31,7 @@ class CsvController extends Controller
protected $wizard; protected $wizard;
/** /**
* @codeCoverageIgnore *
*/ */
public function __construct() public function __construct()
{ {
@@ -106,21 +106,21 @@ class CsvController extends Controller
return redirect(route('csv.index')); return redirect(route('csv.index'));
} }
$data = [ $data = [
'date-format' => Session::get('csv-date-format'), 'date-format' => session('csv-date-format'),
'has-headers' => Session::get('csv-has-headers'), 'has-headers' => session('csv-has-headers'),
]; ];
if (Session::has('csv-map')) { if (Session::has('csv-map')) {
$data['map'] = Session::get('csv-map'); $data['map'] = session('csv-map');
} }
if (Session::has('csv-roles')) { if (Session::has('csv-roles')) {
$data['roles'] = Session::get('csv-roles'); $data['roles'] = session('csv-roles');
} }
if (Session::has('csv-mapped')) { if (Session::has('csv-mapped')) {
$data['mapped'] = Session::get('csv-mapped'); $data['mapped'] = session('csv-mapped');
} }
if (Session::has('csv-specifix')) { if (Session::has('csv-specifix')) {
$data['specifix'] = Session::get('csv-specifix'); $data['specifix'] = session('csv-specifix');
} }
$result = json_encode($data, JSON_PRETTY_PRINT); $result = json_encode($data, JSON_PRETTY_PRINT);

View File

@@ -22,7 +22,7 @@ class CurrencyController extends Controller
/** /**
* @codeCoverageIgnore *
*/ */
public function __construct() public function __construct()
{ {
@@ -40,7 +40,7 @@ class CurrencyController extends Controller
$subTitle = trans('firefly.create_currency'); $subTitle = trans('firefly.create_currency');
// put previous url in session if not redirect from store (not "create another"). // 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::put('currency.create.url', URL::previous());
} }
Session::forget('currency.create.fromStore'); Session::forget('currency.create.fromStore');
@@ -114,7 +114,7 @@ class CurrencyController extends Controller
$currency->delete(); $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); $currency->symbol = htmlentities($currency->symbol);
// put previous url in session if not redirect from store (not "return_to_edit"). // 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::put('currency.edit.url', URL::previous());
} }
Session::forget('currency.edit.fromUpdate'); Session::forget('currency.edit.fromUpdate');
@@ -183,7 +183,7 @@ class CurrencyController extends Controller
} }
// redirect to previous URL. // 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. // redirect to previous URL.
return redirect(Session::get('currency.edit.url')); return redirect(session('currency.edit.url'));
} }

View File

@@ -90,8 +90,8 @@ class HomeController extends Controller
$mainTitleIcon = 'fa-fire'; $mainTitleIcon = 'fa-fire';
$transactions = []; $transactions = [];
$frontPage = Preferences::get('frontPageAccounts', []); $frontPage = Preferences::get('frontPageAccounts', []);
$start = Session::get('start', Carbon::now()->startOfMonth()); $start = session('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->endOfMonth()); $end = session('end', Carbon::now()->endOfMonth());
$showTour = Preferences::get('tour', true)->data; $showTour = Preferences::get('tour', true)->data;
$accounts = $repository->getFrontpageAccounts($frontPage); $accounts = $repository->getFrontpageAccounts($frontPage);
$savings = $repository->getSavingsAccounts(); $savings = $repository->getSavingsAccounts();

View File

@@ -13,7 +13,6 @@ use FireflyIII\Support\CacheProperties;
use Input; use Input;
use Preferences; use Preferences;
use Response; use Response;
use Session;
/** /**
* Class JsonController * Class JsonController
@@ -24,8 +23,6 @@ class JsonController extends Controller
{ {
/** /**
* JsonController constructor. * JsonController constructor.
*
* @codeCoverageIgnore
*/ */
public function __construct() public function __construct()
{ {
@@ -56,8 +53,8 @@ class JsonController extends Controller
*/ */
public function boxBillsPaid(BillRepositoryInterface $repository) public function boxBillsPaid(BillRepositoryInterface $repository)
{ {
$start = Session::get('start', Carbon::now()->startOfMonth()); $start = session('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->endOfMonth()); $end = session('end', Carbon::now()->endOfMonth());
bcscale(2); bcscale(2);
/* /*
@@ -84,8 +81,8 @@ class JsonController extends Controller
public function boxBillsUnpaid(BillRepositoryInterface $repository) public function boxBillsUnpaid(BillRepositoryInterface $repository)
{ {
bcscale(2); bcscale(2);
$start = Session::get('start', Carbon::now()->startOfMonth()); $start = session('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->endOfMonth()); $end = session('end', Carbon::now()->endOfMonth());
$amount = $repository->getBillsUnpaidInRange($start, $end); // will be a positive amount. $amount = $repository->getBillsUnpaidInRange($start, $end); // will be a positive amount.
$creditCardDue = $repository->getCreditCardBill($start, $end); $creditCardDue = $repository->getCreditCardBill($start, $end);
@@ -109,8 +106,8 @@ class JsonController extends Controller
*/ */
public function boxIn(ReportQueryInterface $reportQuery, ARI $accountRepository) public function boxIn(ReportQueryInterface $reportQuery, ARI $accountRepository)
{ {
$start = Session::get('start', Carbon::now()->startOfMonth()); $start = session('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->endOfMonth()); $end = session('end', Carbon::now()->endOfMonth());
// works for json too! // works for json too!
$cache = new CacheProperties; $cache = new CacheProperties;
@@ -138,8 +135,8 @@ class JsonController extends Controller
*/ */
public function boxOut(ReportQueryInterface $reportQuery, ARI $accountRepository) public function boxOut(ReportQueryInterface $reportQuery, ARI $accountRepository)
{ {
$start = Session::get('start', Carbon::now()->startOfMonth()); $start = session('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->endOfMonth()); $end = session('end', Carbon::now()->endOfMonth());
$accounts = $accountRepository->getAccounts(['Default account', 'Asset account', 'Cash account']); $accounts = $accountRepository->getAccounts(['Default account', 'Asset account', 'Cash account']);

View File

@@ -28,7 +28,7 @@ class PiggyBankController extends Controller
{ {
/** /**
* @codeCoverageIgnore *
*/ */
public function __construct() public function __construct()
{ {
@@ -48,7 +48,7 @@ class PiggyBankController extends Controller
public function add(ARI $repository, PiggyBank $piggyBank) public function add(ARI $repository, PiggyBank $piggyBank)
{ {
bcscale(2); bcscale(2);
$date = Session::get('end', Carbon::now()->endOfMonth()); $date = session('end', Carbon::now()->endOfMonth());
$leftOnAccount = $repository->leftOnAccount($piggyBank->account, $date); $leftOnAccount = $repository->leftOnAccount($piggyBank->account, $date);
$savedSoFar = $piggyBank->currentRelevantRep()->currentamount; $savedSoFar = $piggyBank->currentRelevantRep()->currentamount;
$leftToSave = bcsub($piggyBank->targetamount, $savedSoFar); $leftToSave = bcsub($piggyBank->targetamount, $savedSoFar);
@@ -71,7 +71,7 @@ class PiggyBankController extends Controller
$subTitleIcon = 'fa-plus'; $subTitleIcon = 'fa-plus';
// put previous url in session if not redirect from store (not "create another"). // 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::put('piggy-banks.create.url', URL::previous());
} }
Session::forget('piggy-banks.create.fromStore'); Session::forget('piggy-banks.create.fromStore');
@@ -112,7 +112,7 @@ class PiggyBankController extends Controller
Preferences::mark(); Preferences::mark();
$repository->destroy($piggyBank); $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'); Session::flash('gaEventAction', 'edit');
// put previous url in session if not redirect from store (not "return_to_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::put('piggy-banks.edit.url', URL::previous());
} }
Session::forget('piggy-banks.edit.fromUpdate'); Session::forget('piggy-banks.edit.fromUpdate');
@@ -166,7 +166,7 @@ class PiggyBankController extends Controller
{ {
/** @var Collection $piggyBanks */ /** @var Collection $piggyBanks */
$piggyBanks = $piggyRepository->getPiggyBanks(); $piggyBanks = $piggyRepository->getPiggyBanks();
$end = Session::get('end', Carbon::now()->endOfMonth()); $end = session('end', Carbon::now()->endOfMonth());
bcscale(2); bcscale(2);
$accounts = []; $accounts = [];
@@ -228,7 +228,7 @@ class PiggyBankController extends Controller
{ {
bcscale(2); bcscale(2);
$amount = round(Input::get('amount'), 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); $leftOnAccount = $accounts->leftOnAccount($piggyBank->account, $date);
$savedSoFar = $piggyBank->currentRelevantRep()->currentamount; $savedSoFar = $piggyBank->currentRelevantRep()->currentamount;
$leftToSave = bcsub($piggyBank->targetamount, $savedSoFar); $leftToSave = bcsub($piggyBank->targetamount, $savedSoFar);
@@ -341,7 +341,7 @@ class PiggyBankController extends Controller
// redirect to previous URL. // 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. // redirect to previous URL.
return redirect(Session::get('piggy-banks.edit.url')); return redirect(session('piggy-banks.edit.url'));
} }

View File

@@ -72,7 +72,7 @@ class RuleController extends Controller
$subTitle = trans('firefly.make_new_rule', ['title' => $ruleGroup->title]); $subTitle = trans('firefly.make_new_rule', ['title' => $ruleGroup->title]);
// put previous url in session if not redirect from store (not "create another"). // 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::put('rules.rule.create.url', URL::previous());
} }
Session::forget('rules.rule.create.fromStore'); Session::forget('rules.rule.create.fromStore');
@@ -118,7 +118,7 @@ class RuleController extends Controller
Preferences::mark(); 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]); $subTitle = trans('firefly.edit_rule', ['title' => $rule->title]);
// put previous url in session if not redirect from store (not "return_to_edit"). // 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::put('rules.rule.edit.url', URL::previous());
} }
Session::forget('rules.rule.edit.fromUpdate'); Session::forget('rules.rule.edit.fromUpdate');
@@ -274,7 +274,7 @@ class RuleController extends Controller
} }
// redirect to previous URL. // 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. // redirect to previous URL.
return redirect(Session::get('rules.rule.edit.url')); return redirect(session('rules.rule.edit.url'));
} }
private function createDefaultRule() private function createDefaultRule()

View File

@@ -39,7 +39,7 @@ class RuleGroupController extends Controller
$subTitle = trans('firefly.make_new_rule_group'); $subTitle = trans('firefly.make_new_rule_group');
// put previous url in session if not redirect from store (not "create another"). // 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::put('rules.rule-group.create.url', URL::previous());
} }
Session::forget('rules.rule-group.create.fromStore'); Session::forget('rules.rule-group.create.fromStore');
@@ -90,7 +90,7 @@ class RuleGroupController extends Controller
Preferences::mark(); 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]); $subTitle = trans('firefly.edit_rule_group', ['title' => $ruleGroup->title]);
// put previous url in session if not redirect from store (not "return_to_edit"). // 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::put('rules.rule-group.edit.url', URL::previous());
} }
Session::forget('rules.rule-group.edit.fromUpdate'); Session::forget('rules.rule-group.edit.fromUpdate');
@@ -155,7 +155,7 @@ class RuleGroupController extends Controller
} }
// redirect to previous URL. // 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. // redirect to previous URL.
return redirect(Session::get('rules.rule-group.edit.url')); return redirect(session('rules.rule-group.edit.url'));
} }

View File

@@ -35,7 +35,7 @@ class TagController extends Controller
public $tagOptions = []; public $tagOptions = [];
/** /**
* @codeCoverageIgnore *
*/ */
public function __construct() public function __construct()
{ {
@@ -66,7 +66,7 @@ class TagController extends Controller
Session::flash('preFilled', $preFilled); Session::flash('preFilled', $preFilled);
} }
// put previous url in session if not redirect from store (not "create another"). // 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::put('tags.create.url', URL::previous());
} }
Session::forget('tags.create.fromStore'); 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"). // 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::put('tags.edit.url', URL::previous());
} }
Session::forget('tags.edit.fromUpdate'); Session::forget('tags.edit.fromUpdate');
@@ -264,7 +264,7 @@ class TagController extends Controller
} }
// redirect to previous URL. // 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. // redirect to previous URL.
return redirect(Session::get('tags.edit.url')); return redirect(session('tags.edit.url'));
} }
} }

View File

@@ -34,7 +34,7 @@ use View;
class TransactionController extends Controller class TransactionController extends Controller
{ {
/** /**
* @codeCoverageIgnore *
*/ */
public function __construct() public function __construct()
{ {
@@ -66,7 +66,7 @@ class TransactionController extends Controller
$piggies = ExpandedForm::makeSelectList($piggyBanks); $piggies = ExpandedForm::makeSelectList($piggyBanks);
$piggies[0] = trans('form.noPiggybank'); $piggies[0] = trans('form.noPiggybank');
$preFilled = Session::has('preFilled') ? Session::get('preFilled') : []; $preFilled = Session::has('preFilled') ? session('preFilled') : [];
$respondTo = ['account_id', 'account_from_id']; $respondTo = ['account_id', 'account_from_id'];
$subTitle = trans('form.add_new_' . $what); $subTitle = trans('form.add_new_' . $what);
@@ -76,7 +76,7 @@ class TransactionController extends Controller
Session::put('preFilled', $preFilled); Session::put('preFilled', $preFilled);
// put previous url in session if not redirect from store (not "create another"). // 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::put('transactions.create.url', URL::previous());
} }
Session::forget('transactions.create.fromStore'); Session::forget('transactions.create.fromStore');
@@ -126,7 +126,7 @@ class TransactionController extends Controller
Preferences::mark(); Preferences::mark();
// redirect to previous URL: // 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); Session::flash('gaEventAction', 'edit-' . $what);
// put previous url in session if not redirect from store (not "return_to_edit"). // 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::put('transactions.edit.url', URL::previous());
} }
Session::forget('transactions.edit.fromUpdate'); Session::forget('transactions.edit.fromUpdate');
@@ -327,7 +327,7 @@ class TransactionController extends Controller
} }
// redirect to previous URL. // 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. // redirect to previous URL.
return redirect(Session::get('transactions.edit.url')); return redirect(session('transactions.edit.url'));
} }

View File

@@ -18,7 +18,6 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Log; use Log;
use Session;
use Steam; use Steam;
@@ -225,8 +224,8 @@ class AccountRepository implements AccountRepositoryInterface
*/ */
public function getPiggyBankAccounts() public function getPiggyBankAccounts()
{ {
$start = clone Session::get('start', new Carbon); $start = clone session('start', new Carbon);
$end = clone Session::get('end', new Carbon); $end = clone session('end', new Carbon);
$collection = new Collection(DB::table('piggy_banks')->distinct()->get(['piggy_banks.account_id'])); $collection = new Collection(DB::table('piggy_banks')->distinct()->get(['piggy_banks.account_id']));
$ids = $collection->pluck('account_id')->toArray(); $ids = $collection->pluck('account_id')->toArray();
$accounts = new Collection; $accounts = new Collection;
@@ -273,8 +272,8 @@ class AccountRepository implements AccountRepositoryInterface
->where('accounts.active', 1) ->where('accounts.active', 1)
->where('account_meta.data', '"savingAsset"') ->where('account_meta.data', '"savingAsset"')
->get(['accounts.*']); ->get(['accounts.*']);
$start = clone Session::get('start', new Carbon); $start = clone session('start', new Carbon);
$end = clone Session::get('end', new Carbon); $end = clone session('end', new Carbon);
bcscale(2); bcscale(2);

View File

@@ -387,7 +387,7 @@ class ExpandedForm
protected function fillFieldValue($name, $value) protected function fillFieldValue($name, $value)
{ {
if (Session::has('preFilled')) { if (Session::has('preFilled')) {
$preFilled = Session::get('preFilled'); $preFilled = session('preFilled');
$value = isset($preFilled[$name]) && is_null($value) ? $preFilled[$name] : $value; $value = isset($preFilled[$name]) && is_null($value) ? $preFilled[$name] : $value;
} }
// @codeCoverageIgnoreStart // @codeCoverageIgnoreStart
@@ -415,7 +415,7 @@ class ExpandedForm
* Get errors from session: * Get errors from session:
*/ */
/** @var MessageBag $errors */ /** @var MessageBag $errors */
$errors = Session::get('errors'); $errors = session('errors');
$classes = 'form-group'; $classes = 'form-group';
if (!is_null($errors) && $errors->has($name)) { if (!is_null($errors) && $errors->has($name)) {

View File

@@ -7,7 +7,6 @@ use Config;
use FireflyIII\Models\Account; use FireflyIII\Models\Account;
use FireflyIII\Models\Transaction; use FireflyIII\Models\Transaction;
use Route; use Route;
use Session;
use Twig_Extension; use Twig_Extension;
use Twig_SimpleFilter; use Twig_SimpleFilter;
use Twig_SimpleFunction; use Twig_SimpleFunction;
@@ -169,7 +168,7 @@ class General extends Twig_Extension
if (is_null($account)) { if (is_null($account)) {
return 'NULL'; return 'NULL';
} }
$date = Session::get('end', Carbon::now()->endOfMonth()); $date = session('end', Carbon::now()->endOfMonth());
return app('steam')->balance($account, $date); return app('steam')->balance($account, $date);
} }