Skip to content

Firefly III: a personal finances manager

Code clean up [skip ci]

James Colef38984398dfa
diff --git a/app/Console/Commands/UpgradeFireflyInstructions.php b/app/Console/Commands/UpgradeFireflyInstructions.php
index 712438eefa..8b14d6e545 100644
--- a/app/Console/Commands/UpgradeFireflyInstructions.php
+++ b/app/Console/Commands/UpgradeFireflyInstructions.php
@@ -51,7 +51,7 @@ class UpgradeFireflyInstructions extends Command
/** @var string $version */
$version = config('firefly.version');
$config = config('upgrade.text');
- $text = null;
+ $text = null;
foreach (array_keys($config) as $compare) {
// if string starts with:
$len = strlen($compare);
diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php
index ff7afe7528..84662c20ba 100755
--- a/app/Exceptions/Handler.php
+++ b/app/Exceptions/Handler.php
@@ -81,7 +81,7 @@ class Handler extends ExceptionHandler
'id' => 0,
'email' => '[email protected]',
];
- if (Auth::check()) {
+ if (auth()->check()) {
$userData['id'] = Auth::user()->id;
$userData['email'] = Auth::user()->email;
}
diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php
index 355868dd6e..ff47ecc5ec 100644
--- a/app/Http/Controllers/AccountController.php
+++ b/app/Http/Controllers/AccountController.php
@@ -173,9 +173,9 @@ class AccountController extends Controller
$types = config('firefly.accountTypesByIdentifier.' . $what);
$accounts = $crud->getAccountsByType($types);
/** @var Carbon $start */
- $start = clone session('start', Carbon::now()->startOfMonth());
+ $start = clone session('start', Carbon::now()->startOfMonth());
/** @var Carbon $end */
- $end = clone session('end', Carbon::now()->endOfMonth());
+ $end = clone session('end', Carbon::now()->endOfMonth());
$start->subDay();
$ids = $accounts->pluck('id')->toArray();
@@ -207,16 +207,16 @@ class AccountController extends Controller
$subTitle = $account->name;
$range = Preferences::get('viewRange', '1M')->data;
/** @var Carbon $start */
- $start = session('start', Navigation::startOfPeriod(new Carbon, $range));
+ $start = session('start', Navigation::startOfPeriod(new Carbon, $range));
/** @var Carbon $end */
- $end = session('end', Navigation::endOfPeriod(new Carbon, $range));
- $page = intval(Input::get('page'));
- $pageSize = Preferences::get('transactionPageSize', 50)->data;
- $offset = ($page - 1) * $pageSize;
- $set = $repository->journalsInPeriod(new Collection([$account]), [], $start, $end);
- $count = $set->count();
- $subSet = $set->splice($offset, $pageSize);
- $journals = new LengthAwarePaginator($subSet, $count, $pageSize, $page);
+ $end = session('end', Navigation::endOfPeriod(new Carbon, $range));
+ $page = intval(Input::get('page'));
+ $pageSize = Preferences::get('transactionPageSize', 50)->data;
+ $offset = ($page - 1) * $pageSize;
+ $set = $repository->journalsInPeriod(new Collection([$account]), [], $start, $end);
+ $count = $set->count();
+ $subSet = $set->splice($offset, $pageSize);
+ $journals = new LengthAwarePaginator($subSet, $count, $pageSize, $page);
$journals->setPath('accounts/show/' . $account->id);
// grouped other months thing:
diff --git a/app/Http/Controllers/Auth/AuthController.php b/app/Http/Controllers/Auth/AuthController.php
index 59f6d347fd..1a5cc7d951 100644
--- a/app/Http/Controllers/Auth/AuthController.php
+++ b/app/Http/Controllers/Auth/AuthController.php
@@ -11,22 +11,10 @@ declare(strict_types = 1);
namespace FireflyIII\Http\Controllers\Auth;
-use Auth;
-use Config;
-use FireflyIII\Events\UserRegistration;
-use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Http\Controllers\Controller;
-use FireflyIII\Support\Facades\FireflyConfig;
use FireflyIII\User;
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
use Illuminate\Foundation\Auth\ThrottlesLogins;
-use Illuminate\Http\Request;
-use Illuminate\Mail\Message;
-use Illuminate\Support\Facades\Lang;
-use Log;
-use Mail;
-use Session;
-use Swift_TransportException;
use Validator;
@@ -57,7 +45,6 @@ class AuthController extends Controller
}
-
/**
* Create a new user instance after a valid registration.
*
@@ -76,11 +63,6 @@ class AuthController extends Controller
}
-
-
-
-
-
/**
* Get a validator for an incoming registration request.
*
diff --git a/app/Http/Controllers/BillController.php b/app/Http/Controllers/BillController.php
index 71c22a00b8..1aad01c385 100644
--- a/app/Http/Controllers/BillController.php
+++ b/app/Http/Controllers/BillController.php
@@ -130,7 +130,7 @@ class BillController extends Controller
/** @var Carbon $start */
$start = session('start');
/** @var Carbon $end */
- $end = session('end');
+ $end = session('end');
$bills = $repository->getBills();
$bills->each(
diff --git a/app/Http/Controllers/BudgetController.php b/app/Http/Controllers/BudgetController.php
index feb29574ad..e99ba0530e 100644
--- a/app/Http/Controllers/BudgetController.php
+++ b/app/Http/Controllers/BudgetController.php
@@ -252,7 +252,8 @@ class BudgetController extends Controller
$count = $journals->count();
$journals = $journals->slice($offset, $pageSize);
$list = new LengthAwarePaginator($journals, $count, $pageSize);
- $subTitle = trans('firefly.without_budget_between',
+ $subTitle = trans(
+ 'firefly.without_budget_between',
['start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]
);
$list->setPath('/budgets/list/noBudget');
diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.php
index 77ddfde730..c84cdd4e65 100644
--- a/app/Http/Controllers/CategoryController.php
+++ b/app/Http/Controllers/CategoryController.php
@@ -166,9 +166,9 @@ class CategoryController extends Controller
*/
public function show(CRI $repository, AccountCrudInterface $crud, Category $category)
{
- $range = Preferences::get('viewRange', '1M')->data;
+ $range = Preferences::get('viewRange', '1M')->data;
/** @var Carbon $start */
- $start = session('start', Navigation::startOfPeriod(new Carbon, $range));
+ $start = session('start', Navigation::startOfPeriod(new Carbon, $range));
/** @var Carbon $end */
$end = session('end', Navigation::endOfPeriod(new Carbon, $range));
$hideCategory = true; // used in list.
diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php
index 7e4f4af4e7..b1402eb54c 100755
--- a/app/Http/Controllers/Controller.php
+++ b/app/Http/Controllers/Controller.php
@@ -11,15 +11,11 @@ declare(strict_types = 1);
namespace FireflyIII\Http\Controllers;
-use App;
-use Auth;
use Carbon\Carbon;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
-use NumberFormatter;
-use Preferences;
use View;
/**
diff --git a/app/Http/Controllers/CurrencyController.php b/app/Http/Controllers/CurrencyController.php
index 595babeca2..952ea79190 100644
--- a/app/Http/Controllers/CurrencyController.php
+++ b/app/Http/Controllers/CurrencyController.php
@@ -81,7 +81,7 @@ class CurrencyController extends Controller
}
/**
- * @param TransactionCurrency $currency
+ * @param TransactionCurrency $currency
*
* @return \Illuminate\Http\RedirectResponse|View
*/
@@ -105,7 +105,7 @@ class CurrencyController extends Controller
}
/**
- * @param TransactionCurrency $currency
+ * @param TransactionCurrency $currency
*
* @return \Illuminate\Http\RedirectResponse
* @throws \Exception
diff --git a/app/Http/Controllers/PiggyBankController.php b/app/Http/Controllers/PiggyBankController.php
index c3ddece955..5acc9a5a04 100644
--- a/app/Http/Controllers/PiggyBankController.php
+++ b/app/Http/Controllers/PiggyBankController.php
@@ -253,7 +253,7 @@ class PiggyBankController extends Controller
*/
public function postAdd(PiggyBankRepositoryInterface $repository, ARI $accounts, PiggyBank $piggyBank)
{
- $amount = strval(round(Input::get('amount'), 2));
+ $amount = strval(round(Input::get('amount'), 2));
/** @var Carbon $date */
$date = session('end', Carbon::now()->endOfMonth());
$leftOnAccount = $accounts->leftOnAccount($piggyBank->account, $date);
diff --git a/app/Http/Controllers/Popup/ReportController.php b/app/Http/Controllers/Popup/ReportController.php
index a54b0cc1a9..7727114bfb 100644
--- a/app/Http/Controllers/Popup/ReportController.php
+++ b/app/Http/Controllers/Popup/ReportController.php
@@ -112,6 +112,7 @@ class ReportController extends Controller
if ($tags === 0) {
return true;
}
+
return false;
}
);
@@ -194,6 +195,7 @@ class ReportController extends Controller
if ($journal->destination_account_id === $account->id) {
return true;
}
+
return false;
}
);
@@ -229,6 +231,7 @@ class ReportController extends Controller
) {
return true;
}
+
return false;
}
);
diff --git a/app/Http/Requests/AccountFormRequest.php b/app/Http/Requests/AccountFormRequest.php
index bac9b3244b..2522a9440d 100644
--- a/app/Http/Requests/AccountFormRequest.php
+++ b/app/Http/Requests/AccountFormRequest.php
@@ -11,7 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Http\Requests;
-use Auth;
use FireflyIII\Models\Account;
use Input;
@@ -29,7 +28,7 @@ class AccountFormRequest extends Request
public function authorize()
{
// Only allow logged in users
- return Auth::check();
+ return auth()->check();
}
/**
diff --git a/app/Http/Requests/AttachmentFormRequest.php b/app/Http/Requests/AttachmentFormRequest.php
index 39be3474c3..2f3a6712c1 100644
--- a/app/Http/Requests/AttachmentFormRequest.php
+++ b/app/Http/Requests/AttachmentFormRequest.php
@@ -11,8 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Http\Requests;
-use Auth;
-
/**
* Class AttachmentFormRequest
*
@@ -27,7 +25,7 @@ class AttachmentFormRequest extends Request
public function authorize()
{
// Only allow logged in users
- return Auth::check();
+ return auth()->check();
}
/**
diff --git a/app/Http/Requests/BillFormRequest.php b/app/Http/Requests/BillFormRequest.php
index 1698dd2d67..5d9a975a02 100644
--- a/app/Http/Requests/BillFormRequest.php
+++ b/app/Http/Requests/BillFormRequest.php
@@ -29,7 +29,7 @@ class BillFormRequest extends Request
public function authorize()
{
// Only allow logged in users
- return Auth::check();
+ return auth()->check();
}
/**
diff --git a/app/Http/Requests/BudgetFormRequest.php b/app/Http/Requests/BudgetFormRequest.php
index 40afc68dc2..3dbb576214 100644
--- a/app/Http/Requests/BudgetFormRequest.php
+++ b/app/Http/Requests/BudgetFormRequest.php
@@ -11,7 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Http\Requests;
-use Auth;
use FireflyIII\Models\Budget;
use Input;
@@ -29,7 +28,7 @@ class BudgetFormRequest extends Request
public function authorize()
{
// Only allow logged in users
- return Auth::check();
+ return auth()->check();
}
/**
diff --git a/app/Http/Requests/CategoryFormRequest.php b/app/Http/Requests/CategoryFormRequest.php
index cff83980d6..02b95cb14f 100644
--- a/app/Http/Requests/CategoryFormRequest.php
+++ b/app/Http/Requests/CategoryFormRequest.php
@@ -11,7 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Http\Requests;
-use Auth;
use FireflyIII\Models\Category;
use Input;
@@ -29,7 +28,7 @@ class CategoryFormRequest extends Request
public function authorize()
{
// Only allow logged in users
- return Auth::check();
+ return auth()->check();
}
/**
diff --git a/app/Http/Requests/ConfigurationRequest.php b/app/Http/Requests/ConfigurationRequest.php
index 64b17bddc3..74b26161f5 100644
--- a/app/Http/Requests/ConfigurationRequest.php
+++ b/app/Http/Requests/ConfigurationRequest.php
@@ -27,7 +27,7 @@ class ConfigurationRequest extends Request
public function authorize()
{
// Only allow logged in users and admins
- return Auth::check() && Auth::user()->hasRole('owner');
+ return auth()->check() && Auth::user()->hasRole('owner');
}
/**
diff --git a/app/Http/Requests/CurrencyFormRequest.php b/app/Http/Requests/CurrencyFormRequest.php
index ccdd04fa38..818597c3d1 100644
--- a/app/Http/Requests/CurrencyFormRequest.php
+++ b/app/Http/Requests/CurrencyFormRequest.php
@@ -11,7 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Http\Requests;
-use Auth;
use Input;
/**
@@ -28,7 +27,7 @@ class CurrencyFormRequest extends Request
public function authorize()
{
// Only allow logged in users
- return Auth::check();
+ return auth()->check();
}
/**
diff --git a/app/Http/Requests/DeleteAccountFormRequest.php b/app/Http/Requests/DeleteAccountFormRequest.php
index 60a4ee9994..137e718a30 100644
--- a/app/Http/Requests/DeleteAccountFormRequest.php
+++ b/app/Http/Requests/DeleteAccountFormRequest.php
@@ -11,8 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Http\Requests;
-use Auth;
-
/**
* Class DeleteAccountFormRequest
*
@@ -27,7 +25,7 @@ class DeleteAccountFormRequest extends Request
public function authorize()
{
// Only allow logged in users
- return Auth::check();
+ return auth()->check();
}
/**
diff --git a/app/Http/Requests/ExportFormRequest.php b/app/Http/Requests/ExportFormRequest.php
index 4c0f9e0639..e20e38cf9a 100644
--- a/app/Http/Requests/ExportFormRequest.php
+++ b/app/Http/Requests/ExportFormRequest.php
@@ -11,7 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Http\Requests;
-use Auth;
use Carbon\Carbon;
/**
@@ -28,7 +27,7 @@ class ExportFormRequest extends Request
public function authorize()
{
// Only allow logged in users
- return Auth::check();
+ return auth()->check();
}
/**
diff --git a/app/Http/Requests/ImportUploadRequest.php b/app/Http/Requests/ImportUploadRequest.php
index 0f1e39155b..0884ed524f 100644
--- a/app/Http/Requests/ImportUploadRequest.php
+++ b/app/Http/Requests/ImportUploadRequest.php
@@ -11,8 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Http\Requests;
-use Auth;
-
/**
* Class ImportUploadRequest
*
@@ -27,7 +25,7 @@ class ImportUploadRequest extends Request
public function authorize()
{
// Only allow logged in users
- return Auth::check();
+ return auth()->check();
}
/**
diff --git a/app/Http/Requests/JournalFormRequest.php b/app/Http/Requests/JournalFormRequest.php
index 6c0e44da66..fa59a96cbd 100644
--- a/app/Http/Requests/JournalFormRequest.php
+++ b/app/Http/Requests/JournalFormRequest.php
@@ -32,7 +32,7 @@ class JournalFormRequest extends Request
public function authorize()
{
// Only allow logged in users
- return Auth::check();
+ return auth()->check();
}
/**
diff --git a/app/Http/Requests/MassDeleteJournalRequest.php b/app/Http/Requests/MassDeleteJournalRequest.php
index 967bd9e031..167d8f306f 100644
--- a/app/Http/Requests/MassDeleteJournalRequest.php
+++ b/app/Http/Requests/MassDeleteJournalRequest.php
@@ -11,8 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Http\Requests;
-use Auth;
-
/**
* Class MassDeleteJournalRequest
*
@@ -27,7 +25,7 @@ class MassDeleteJournalRequest extends Request
public function authorize()
{
// Only allow logged in users
- return Auth::check();
+ return auth()->check();
}
/**
diff --git a/app/Http/Requests/MassEditJournalRequest.php b/app/Http/Requests/MassEditJournalRequest.php
index fcd9905221..7f7ae97f89 100644
--- a/app/Http/Requests/MassEditJournalRequest.php
+++ b/app/Http/Requests/MassEditJournalRequest.php
@@ -11,8 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Http\Requests;
-use Auth;
-
/**
* Class MassEditJournalRequest
*
@@ -27,7 +25,7 @@ class MassEditJournalRequest extends Request
public function authorize()
{
// Only allow logged in users
- return Auth::check();
+ return auth()->check();
}
/**
diff --git a/app/Http/Requests/NewUserFormRequest.php b/app/Http/Requests/NewUserFormRequest.php
index 8ddc64fa7d..24b094b48d 100644
--- a/app/Http/Requests/NewUserFormRequest.php
+++ b/app/Http/Requests/NewUserFormRequest.php
@@ -11,8 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Http\Requests;
-use Auth;
-
/**
* Class NewUserFormRequest
*
@@ -27,7 +25,7 @@ class NewUserFormRequest extends Request
public function authorize()
{
// Only allow logged in users
- return Auth::check();
+ return auth()->check();
}
/**
diff --git a/app/Http/Requests/PiggyBankFormRequest.php b/app/Http/Requests/PiggyBankFormRequest.php
index 026a4684db..0363a37f33 100644
--- a/app/Http/Requests/PiggyBankFormRequest.php
+++ b/app/Http/Requests/PiggyBankFormRequest.php
@@ -11,7 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Http\Requests;
-use Auth;
use Input;
/**
@@ -28,7 +27,7 @@ class PiggyBankFormRequest extends Request
public function authorize()
{
// Only allow logged in users
- return Auth::check();
+ return auth()->check();
}
/**
diff --git a/app/Http/Requests/ProfileFormRequest.php b/app/Http/Requests/ProfileFormRequest.php
index 2017ab61d0..0b20e398d3 100644
--- a/app/Http/Requests/ProfileFormRequest.php
+++ b/app/Http/Requests/ProfileFormRequest.php
@@ -11,8 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Http\Requests;
-use Auth;
-
/**
* Class ProfileFormRequest
*
@@ -27,7 +25,7 @@ class ProfileFormRequest extends Request
public function authorize()
{
// Only allow logged in users
- return Auth::check();
+ return auth()->check();
}
/**
diff --git a/app/Http/Requests/RuleFormRequest.php b/app/Http/Requests/RuleFormRequest.php
index d1c6ef82fc..ffb057bcdd 100644
--- a/app/Http/Requests/RuleFormRequest.php
+++ b/app/Http/Requests/RuleFormRequest.php
@@ -11,7 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Http\Requests;
-use Auth;
use FireflyIII\Models\RuleGroup;
use Input;
@@ -29,7 +28,7 @@ class RuleFormRequest extends Request
public function authorize()
{
// Only allow logged in users
- return Auth::check();
+ return auth()->check();
}
/**
diff --git a/app/Http/Requests/RuleGroupFormRequest.php b/app/Http/Requests/RuleGroupFormRequest.php
index 0616a869a9..6160d4fd58 100644
--- a/app/Http/Requests/RuleGroupFormRequest.php
+++ b/app/Http/Requests/RuleGroupFormRequest.php
@@ -18,7 +18,6 @@ declare(strict_types = 1);
namespace FireflyIII\Http\Requests;
-use Auth;
use FireflyIII\Models\RuleGroup;
use Input;
@@ -36,7 +35,7 @@ class RuleGroupFormRequest extends Request
public function authorize()
{
// Only allow logged in users
- return Auth::check();
+ return auth()->check();
}
/**
diff --git a/app/Http/Requests/SelectTransactionsRequest.php b/app/Http/Requests/SelectTransactionsRequest.php
index e6f71a0190..b11e2db6aa 100644
--- a/app/Http/Requests/SelectTransactionsRequest.php
+++ b/app/Http/Requests/SelectTransactionsRequest.php
@@ -11,7 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Http\Requests;
-use Auth;
use Carbon\Carbon;
/**
@@ -28,7 +27,7 @@ class SelectTransactionsRequest extends Request
public function authorize()
{
// Only allow logged in users
- return Auth::check();
+ return auth()->check();
}
/**
diff --git a/app/Http/Requests/SplitJournalFormRequest.php b/app/Http/Requests/SplitJournalFormRequest.php
index 7e49abb331..828a79b888 100644
--- a/app/Http/Requests/SplitJournalFormRequest.php
+++ b/app/Http/Requests/SplitJournalFormRequest.php
@@ -11,7 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Http\Requests;
-use Auth;
use Carbon\Carbon;
@@ -28,7 +27,7 @@ class SplitJournalFormRequest extends Request
public function authorize(): bool
{
// Only allow logged in users
- return Auth::check();
+ return auth()->check();
}
/**
diff --git a/app/Http/Requests/TagFormRequest.php b/app/Http/Requests/TagFormRequest.php
index 9719cd6a94..bb69349675 100644
--- a/app/Http/Requests/TagFormRequest.php
+++ b/app/Http/Requests/TagFormRequest.php
@@ -10,7 +10,6 @@
declare(strict_types = 1);
namespace FireflyIII\Http\Requests;
-use Auth;
use Carbon\Carbon;
use FireflyIII\Models\Tag;
use Input;
@@ -29,7 +28,7 @@ class TagFormRequest extends Request
public function authorize()
{
// Only allow logged in users
- return Auth::check();
+ return auth()->check();
}
/**
diff --git a/app/Http/Requests/TestRuleFormRequest.php b/app/Http/Requests/TestRuleFormRequest.php
index 377b8c55ef..9eba85b2f4 100644
--- a/app/Http/Requests/TestRuleFormRequest.php
+++ b/app/Http/Requests/TestRuleFormRequest.php
@@ -11,8 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Http\Requests;
-use Auth;
-
/**
* Class RuleFormRequest
*
@@ -27,7 +25,7 @@ class TestRuleFormRequest extends Request
public function authorize()
{
// Only allow logged in users
- return Auth::check();
+ return auth()->check();
}
/**
diff --git a/app/Http/Requests/TokenFormRequest.php b/app/Http/Requests/TokenFormRequest.php
index b971878f1e..bdf9410799 100644
--- a/app/Http/Requests/TokenFormRequest.php
+++ b/app/Http/Requests/TokenFormRequest.php
@@ -11,8 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Http\Requests;
-use Auth;
-
/**
* Class TokenFormRequest
*
@@ -27,7 +25,7 @@ class TokenFormRequest extends Request
public function authorize()
{
// Only allow logged in users
- return Auth::check();
+ return auth()->check();
}
/**
diff --git a/app/Models/Account.php b/app/Models/Account.php
index 74ccfff502..429a0ced6f 100644
--- a/app/Models/Account.php
+++ b/app/Models/Account.php
@@ -153,7 +153,7 @@ class Account extends Model
public static function routeBinder(Account $value)
{
- if (Auth::check()) {
+ if (auth()->check()) {
if ($value->user_id == Auth::user()->id) {
return $value;
}
diff --git a/app/Models/Attachment.php b/app/Models/Attachment.php
index 1572959d1b..e92db070fb 100644
--- a/app/Models/Attachment.php
+++ b/app/Models/Attachment.php
@@ -69,7 +69,7 @@ class Attachment extends Model
*/
public static function routeBinder(Attachment $value)
{
- if (Auth::check()) {
+ if (auth()->check()) {
if ($value->user_id == Auth::user()->id) {
return $value;
diff --git a/app/Models/Bill.php b/app/Models/Bill.php
index 860a14d16f..e6262f58d9 100644
--- a/app/Models/Bill.php
+++ b/app/Models/Bill.php
@@ -81,7 +81,7 @@ class Bill extends Model
*/
public static function routeBinder(Bill $value)
{
- if (Auth::check()) {
+ if (auth()->check()) {
if ($value->user_id == Auth::user()->id) {
return $value;
}
diff --git a/app/Models/Budget.php b/app/Models/Budget.php
index a5be969f4f..3eccc9585a 100644
--- a/app/Models/Budget.php
+++ b/app/Models/Budget.php
@@ -94,7 +94,7 @@ class Budget extends Model
*/
public static function routeBinder(Budget $value)
{
- if (Auth::check()) {
+ if (auth()->check()) {
if ($value->user_id == Auth::user()->id) {
return $value;
}
diff --git a/app/Models/Category.php b/app/Models/Category.php
index 1568847992..df693cbc15 100644
--- a/app/Models/Category.php
+++ b/app/Models/Category.php
@@ -89,7 +89,7 @@ class Category extends Model
*/
public static function routeBinder(Category $value)
{
- if (Auth::check()) {
+ if (auth()->check()) {
if ($value->user_id == Auth::user()->id) {
return $value;
}
diff --git a/app/Models/ExportJob.php b/app/Models/ExportJob.php
index 8babcf7036..095655bbf5 100644
--- a/app/Models/ExportJob.php
+++ b/app/Models/ExportJob.php
@@ -44,7 +44,7 @@ class ExportJob extends Model
*/
public static function routeBinder($value)
{
- if (Auth::check()) {
+ if (auth()->check()) {
$model = self::where('key', $value)->where('user_id', Auth::user()->id)->first();
if (!is_null($model)) {
return $model;
diff --git a/app/Models/ImportJob.php b/app/Models/ImportJob.php
index 08d0ff89ac..053426411f 100644
--- a/app/Models/ImportJob.php
+++ b/app/Models/ImportJob.php
@@ -62,7 +62,7 @@ class ImportJob extends Model
*/
public static function routeBinder($value)
{
- if (Auth::check()) {
+ if (auth()->check()) {
$model = self::where('key', $value)->where('user_id', Auth::user()->id)->first();
if (!is_null($model)) {
return $model;
diff --git a/app/Models/LimitRepetition.php b/app/Models/LimitRepetition.php
index ae578cea03..d9f8526d7a 100644
--- a/app/Models/LimitRepetition.php
+++ b/app/Models/LimitRepetition.php
@@ -54,7 +54,7 @@ class LimitRepetition extends Model
*/
public static function routeBinder($value)
{
- if (Auth::check()) {
+ if (auth()->check()) {
$object = LimitRepetition::where('limit_repetitions.id', $value)
->leftJoin('budget_limits', 'budget_limits.id', '=', 'limit_repetitions.budget_limit_id')
->leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id')
diff --git a/app/Models/PiggyBank.php b/app/Models/PiggyBank.php
index af2d12a102..7b732999e7 100644
--- a/app/Models/PiggyBank.php
+++ b/app/Models/PiggyBank.php
@@ -70,7 +70,7 @@ class PiggyBank extends Model
*/
public static function routeBinder(PiggyBank $value)
{
- if (Auth::check()) {
+ if (auth()->check()) {
if ($value->account->user_id == Auth::user()->id) {
return $value;
}
diff --git a/app/Models/Rule.php b/app/Models/Rule.php
index 368a4f8d87..c06661277b 100644
--- a/app/Models/Rule.php
+++ b/app/Models/Rule.php
@@ -59,7 +59,7 @@ class Rule extends Model
*/
public static function routeBinder(Rule $value)
{
- if (Auth::check()) {
+ if (auth()->check()) {
if ($value->user_id == Auth::user()->id) {
return $value;
}
diff --git a/app/Models/RuleGroup.php b/app/Models/RuleGroup.php
index 08a8835206..1fd63e13f0 100644
--- a/app/Models/RuleGroup.php
+++ b/app/Models/RuleGroup.php
@@ -55,7 +55,7 @@ class RuleGroup extends Model
*/
public static function routeBinder(RuleGroup $value)
{
- if (Auth::check()) {
+ if (auth()->check()) {
if ($value->user_id == Auth::user()->id) {
return $value;
}
diff --git a/app/Models/Tag.php b/app/Models/Tag.php
index 0b21b5627e..da031b66ff 100644
--- a/app/Models/Tag.php
+++ b/app/Models/Tag.php
@@ -96,7 +96,7 @@ class Tag extends TagSupport
*/
public static function routeBinder(Tag $value)
{
- if (Auth::check()) {
+ if (auth()->check()) {
if ($value->user_id == Auth::user()->id) {
return $value;
}
diff --git a/app/Models/TransactionCurrency.php b/app/Models/TransactionCurrency.php
index 84208e2a22..aa6ac48eed 100644
--- a/app/Models/TransactionCurrency.php
+++ b/app/Models/TransactionCurrency.php
@@ -11,7 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Models;
-use Auth;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -53,7 +52,7 @@ class TransactionCurrency extends Model
*/
public static function routeBinder(TransactionCurrency $currency)
{
- if (Auth::check()) {
+ if (auth()->check()) {
return $currency;
}
throw new NotFoundHttpException;
diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.php
index 1823da0f6a..09c7fb4d83 100644
--- a/app/Models/TransactionJournal.php
+++ b/app/Models/TransactionJournal.php
@@ -128,7 +128,7 @@ class TransactionJournal extends TransactionJournalSupport
*/
public static function routeBinder($value)
{
- if (Auth::check()) {
+ if (auth()->check()) {
$validTypes = [TransactionType::WITHDRAWAL, TransactionType::DEPOSIT, TransactionType::TRANSFER];
$object = TransactionJournal::where('transaction_journals.id', $value)
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
@@ -380,7 +380,8 @@ class TransactionJournal extends TransactionJournalSupport
'transaction_journals.completed',
'transaction_types.type',
'transaction_currencies.code',
- ]);
+ ]
+ );
$query->with(['categories', 'budgets', 'attachments', 'bill', 'transactions']);
}
diff --git a/app/Providers/BroadcastServiceProvider.php b/app/Providers/BroadcastServiceProvider.php
index 8015d66825..e2604745e8 100755
--- a/app/Providers/BroadcastServiceProvider.php
+++ b/app/Providers/BroadcastServiceProvider.php
@@ -2,8 +2,8 @@
namespace FireflyIII\Providers;
-use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Broadcast;
+use Illuminate\Support\ServiceProvider;
class BroadcastServiceProvider extends ServiceProvider
{
@@ -19,8 +19,10 @@ class BroadcastServiceProvider extends ServiceProvider
/*
* Authenticate the user's personal channel...
*/
- Broadcast::channel('App.User.*', function ($user, $userId) {
- return (int) $user->id === (int) $userId;
- });
+ Broadcast::channel(
+ 'App.User.*', function ($user, $userId) {
+ return (int)$user->id === (int)$userId;
+ }
+ );
}
}
diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php
index a7d036984f..1c3e8234ab 100755
--- a/app/Providers/RouteServiceProvider.php
+++ b/app/Providers/RouteServiceProvider.php
@@ -2,8 +2,8 @@
namespace FireflyIII\Providers;
-use Illuminate\Support\Facades\Route;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
+use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider
{
@@ -43,37 +43,41 @@ class RouteServiceProvider extends ServiceProvider
}
/**
- * Define the "web" routes for the application.
+ * Define the "api" routes for the application.
*
- * These routes all receive session state, CSRF protection, etc.
+ * These routes are typically stateless.
*
* @return void
*/
- protected function mapWebRoutes()
+ protected function mapApiRoutes()
{
- Route::group([
- 'middleware' => 'web',
- 'namespace' => $this->namespace,
- ], function ($router) {
- require base_path('routes/web.php');
- });
+ Route::group(
+ [
+ 'middleware' => 'api',
+ 'namespace' => $this->namespace,
+ 'prefix' => 'api',
+ ], function ($router) {
+ require base_path('routes/api.php');
+ }
+ );
}
/**
- * Define the "api" routes for the application.
+ * Define the "web" routes for the application.
*
- * These routes are typically stateless.
+ * These routes all receive session state, CSRF protection, etc.
*
* @return void
*/
- protected function mapApiRoutes()
+ protected function mapWebRoutes()
{
- Route::group([
- 'middleware' => 'api',
- 'namespace' => $this->namespace,
- 'prefix' => 'api',
- ], function ($router) {
- require base_path('routes/api.php');
- });
+ Route::group(
+ [
+ 'middleware' => 'web',
+ 'namespace' => $this->namespace,
+ ], function ($router) {
+ require base_path('routes/web.php');
+ }
+ );
}
}
diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php
index bb675ef09b..4c44bc263b 100644
--- a/app/Repositories/Account/AccountRepository.php
+++ b/app/Repositories/Account/AccountRepository.php
@@ -431,10 +431,12 @@ class AccountRepository implements AccountRepositoryInterface
$fields[] = 'destination.account_id as destination_account_id';
$fields[] = 'destination.amount as destination_amount';
- $query->groupBy(['source.account_id',
- 'source.amount',
- 'destination.account_id',
- 'destination.amount',]);
+ $query->groupBy(
+ ['source.account_id',
+ 'source.amount',
+ 'destination.account_id',
+ 'destination.amount',]
+ );
$complete = $query->get($fields);
diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.php
index d06a566ac2..aee6e0e42c 100644
--- a/app/Repositories/Bill/BillRepository.php
+++ b/app/Repositories/Bill/BillRepository.php
@@ -134,7 +134,7 @@ class BillRepository implements BillRepositoryInterface
->whereIn('bill_id', $ids)
->before($end)
->after($start)
- ->groupBy(['transaction_journals.bill_id','transaction_journals.id'])
+ ->groupBy(['transaction_journals.bill_id', 'transaction_journals.id'])
->get(
[
'transaction_journals.bill_id',
diff --git a/app/Rules/Triggers/AbstractTrigger.php b/app/Rules/Triggers/AbstractTrigger.php
index 45234606c8..508c79359a 100644
--- a/app/Rules/Triggers/AbstractTrigger.php
+++ b/app/Rules/Triggers/AbstractTrigger.php
@@ -115,6 +115,4 @@ class AbstractTrigger
}
-
-
}
diff --git a/app/Support/Binder/AccountList.php b/app/Support/Binder/AccountList.php
index e1b351a459..525e9a3dbb 100644
--- a/app/Support/Binder/AccountList.php
+++ b/app/Support/Binder/AccountList.php
@@ -34,7 +34,7 @@ class AccountList implements BinderInterface
public static function routeBinder($value, $route): Collection
{
- if (Auth::check()) {
+ if (auth()->check()) {
$ids = explode(',', $value);
// filter ids:
diff --git a/app/Support/Binder/BudgetList.php b/app/Support/Binder/BudgetList.php
index a168a9d1e4..98a8b465a9 100644
--- a/app/Support/Binder/BudgetList.php
+++ b/app/Support/Binder/BudgetList.php
@@ -33,7 +33,7 @@ class BudgetList implements BinderInterface
*/
public static function routeBinder($value, $route): Collection
{
- if (Auth::check()) {
+ if (auth()->check()) {
$ids = explode(',', $value);
/** @var \Illuminate\Support\Collection $object */
$object = Budget::where('active', 1)
diff --git a/app/Support/Binder/CategoryList.php b/app/Support/Binder/CategoryList.php
index 1b60c294d7..d1fabdad84 100644
--- a/app/Support/Binder/CategoryList.php
+++ b/app/Support/Binder/CategoryList.php
@@ -32,7 +32,7 @@ class CategoryList implements BinderInterface
*/
public static function routeBinder($value, $route): Collection
{
- if (Auth::check()) {
+ if (auth()->check()) {
$ids = explode(',', $value);
/** @var \Illuminate\Support\Collection $object */
$object = Category::whereIn('id', $ids)
diff --git a/app/Support/Binder/JournalList.php b/app/Support/Binder/JournalList.php
index 2e1873e289..9ef829c8c9 100644
--- a/app/Support/Binder/JournalList.php
+++ b/app/Support/Binder/JournalList.php
@@ -32,7 +32,7 @@ class JournalList implements BinderInterface
*/
public static function routeBinder($value, $route): Collection
{
- if (Auth::check()) {
+ if (auth()->check()) {
$ids = explode(',', $value);
/** @var \Illuminate\Support\Collection $object */
$object = TransactionJournal::whereIn('transaction_journals.id', $ids)
diff --git a/app/Support/Binder/UnfinishedJournal.php b/app/Support/Binder/UnfinishedJournal.php
index 52f3d3aa26..61c413f3ba 100644
--- a/app/Support/Binder/UnfinishedJournal.php
+++ b/app/Support/Binder/UnfinishedJournal.php
@@ -32,7 +32,7 @@ class UnfinishedJournal implements BinderInterface
*/
public static function routeBinder($value, $route): TransactionJournal
{
- if (Auth::check()) {
+ if (auth()->check()) {
$object = TransactionJournal::where('transaction_journals.id', $value)
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
->where('completed', 0)
diff --git a/app/Support/CacheProperties.php b/app/Support/CacheProperties.php
index c571e659ba..6dfd62671d 100644
--- a/app/Support/CacheProperties.php
+++ b/app/Support/CacheProperties.php
@@ -38,7 +38,7 @@ class CacheProperties
public function __construct()
{
$this->properties = new Collection;
- if (Auth::check()) {
+ if (auth()->check()) {
$this->addProperty(Auth::user()->id);
$this->addProperty(Prefs::lastActivity());
}
diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.php
index 34bb493891..e6805b5ee0 100644
--- a/app/Validation/FireflyValidator.php
+++ b/app/Validation/FireflyValidator.php
@@ -224,7 +224,7 @@ class FireflyValidator extends Validator
public function validateUniqueAccountForUser($attribute, $value, $parameters): bool
{
// because a user does not have to be logged in (tests and what-not).
- if (!Auth::check()) {
+ if (!auth()->check()) {
return $this->validateAccountAnonymously();
}