mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-23 15:40:32 -06:00
Code clean up [skip ci]
This commit is contained in:
parent
a07799cfa4
commit
f38984398d
@ -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);
|
||||
|
@ -81,7 +81,7 @@ class Handler extends ExceptionHandler
|
||||
'id' => 0,
|
||||
'email' => 'unknown@example.com',
|
||||
];
|
||||
if (Auth::check()) {
|
||||
if (auth()->check()) {
|
||||
$userData['id'] = Auth::user()->id;
|
||||
$userData['email'] = Auth::user()->email;
|
||||
}
|
||||
|
@ -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:
|
||||
|
@ -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.
|
||||
*
|
||||
|
@ -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(
|
||||
|
@ -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');
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
);
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -29,7 +29,7 @@ class BillFormRequest extends Request
|
||||
public function authorize()
|
||||
{
|
||||
// Only allow logged in users
|
||||
return Auth::check();
|
||||
return auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -32,7 +32,7 @@ class JournalFormRequest extends Request
|
||||
public function authorize()
|
||||
{
|
||||
// Only allow logged in users
|
||||
return Auth::check();
|
||||
return auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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')
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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']);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
{
|
||||
@ -42,23 +42,6 @@ class RouteServiceProvider extends ServiceProvider
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "web" routes for the application.
|
||||
*
|
||||
* These routes all receive session state, CSRF protection, etc.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapWebRoutes()
|
||||
{
|
||||
Route::group([
|
||||
'middleware' => 'web',
|
||||
'namespace' => $this->namespace,
|
||||
], function ($router) {
|
||||
require base_path('routes/web.php');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "api" routes for the application.
|
||||
*
|
||||
@ -68,12 +51,33 @@ class RouteServiceProvider extends ServiceProvider
|
||||
*/
|
||||
protected function mapApiRoutes()
|
||||
{
|
||||
Route::group([
|
||||
'middleware' => 'api',
|
||||
'namespace' => $this->namespace,
|
||||
'prefix' => 'api',
|
||||
], function ($router) {
|
||||
Route::group(
|
||||
[
|
||||
'middleware' => 'api',
|
||||
'namespace' => $this->namespace,
|
||||
'prefix' => 'api',
|
||||
], function ($router) {
|
||||
require base_path('routes/api.php');
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "web" routes for the application.
|
||||
*
|
||||
* These routes all receive session state, CSRF protection, etc.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapWebRoutes()
|
||||
{
|
||||
Route::group(
|
||||
[
|
||||
'middleware' => 'web',
|
||||
'namespace' => $this->namespace,
|
||||
], function ($router) {
|
||||
require base_path('routes/web.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);
|
||||
|
||||
|
@ -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',
|
||||
|
@ -115,6 +115,4 @@ class AbstractTrigger
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -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:
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user