mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Code clean up [skip ci]
This commit is contained in:
parent
a07799cfa4
commit
f38984398d
@ -81,7 +81,7 @@ class Handler extends ExceptionHandler
|
|||||||
'id' => 0,
|
'id' => 0,
|
||||||
'email' => 'unknown@example.com',
|
'email' => 'unknown@example.com',
|
||||||
];
|
];
|
||||||
if (Auth::check()) {
|
if (auth()->check()) {
|
||||||
$userData['id'] = Auth::user()->id;
|
$userData['id'] = Auth::user()->id;
|
||||||
$userData['email'] = Auth::user()->email;
|
$userData['email'] = Auth::user()->email;
|
||||||
}
|
}
|
||||||
|
@ -11,22 +11,10 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Controllers\Auth;
|
namespace FireflyIII\Http\Controllers\Auth;
|
||||||
|
|
||||||
use Auth;
|
|
||||||
use Config;
|
|
||||||
use FireflyIII\Events\UserRegistration;
|
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
|
||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
use FireflyIII\Support\Facades\FireflyConfig;
|
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
|
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
|
||||||
use Illuminate\Foundation\Auth\ThrottlesLogins;
|
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;
|
use Validator;
|
||||||
|
|
||||||
|
|
||||||
@ -57,7 +45,6 @@ class AuthController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new user instance after a valid registration.
|
* 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.
|
* Get a validator for an incoming registration request.
|
||||||
*
|
*
|
||||||
|
@ -252,7 +252,8 @@ class BudgetController extends Controller
|
|||||||
$count = $journals->count();
|
$count = $journals->count();
|
||||||
$journals = $journals->slice($offset, $pageSize);
|
$journals = $journals->slice($offset, $pageSize);
|
||||||
$list = new LengthAwarePaginator($journals, $count, $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)]
|
['start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]
|
||||||
);
|
);
|
||||||
$list->setPath('/budgets/list/noBudget');
|
$list->setPath('/budgets/list/noBudget');
|
||||||
|
@ -11,15 +11,11 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Controllers;
|
namespace FireflyIII\Http\Controllers;
|
||||||
|
|
||||||
use App;
|
|
||||||
use Auth;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||||
use Illuminate\Routing\Controller as BaseController;
|
use Illuminate\Routing\Controller as BaseController;
|
||||||
use NumberFormatter;
|
|
||||||
use Preferences;
|
|
||||||
use View;
|
use View;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -112,6 +112,7 @@ class ReportController extends Controller
|
|||||||
if ($tags === 0) {
|
if ($tags === 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -194,6 +195,7 @@ class ReportController extends Controller
|
|||||||
if ($journal->destination_account_id === $account->id) {
|
if ($journal->destination_account_id === $account->id) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -229,6 +231,7 @@ class ReportController extends Controller
|
|||||||
) {
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -11,7 +11,6 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Requests;
|
namespace FireflyIII\Http\Requests;
|
||||||
|
|
||||||
use Auth;
|
|
||||||
use FireflyIII\Models\Account;
|
use FireflyIII\Models\Account;
|
||||||
use Input;
|
use Input;
|
||||||
|
|
||||||
@ -29,7 +28,7 @@ class AccountFormRequest extends Request
|
|||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
// Only allow logged in users
|
// Only allow logged in users
|
||||||
return Auth::check();
|
return auth()->check();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,8 +11,6 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Requests;
|
namespace FireflyIII\Http\Requests;
|
||||||
|
|
||||||
use Auth;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class AttachmentFormRequest
|
* Class AttachmentFormRequest
|
||||||
*
|
*
|
||||||
@ -27,7 +25,7 @@ class AttachmentFormRequest extends Request
|
|||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
// Only allow logged in users
|
// Only allow logged in users
|
||||||
return Auth::check();
|
return auth()->check();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,7 +29,7 @@ class BillFormRequest extends Request
|
|||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
// Only allow logged in users
|
// Only allow logged in users
|
||||||
return Auth::check();
|
return auth()->check();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,7 +11,6 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Requests;
|
namespace FireflyIII\Http\Requests;
|
||||||
|
|
||||||
use Auth;
|
|
||||||
use FireflyIII\Models\Budget;
|
use FireflyIII\Models\Budget;
|
||||||
use Input;
|
use Input;
|
||||||
|
|
||||||
@ -29,7 +28,7 @@ class BudgetFormRequest extends Request
|
|||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
// Only allow logged in users
|
// Only allow logged in users
|
||||||
return Auth::check();
|
return auth()->check();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,7 +11,6 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Requests;
|
namespace FireflyIII\Http\Requests;
|
||||||
|
|
||||||
use Auth;
|
|
||||||
use FireflyIII\Models\Category;
|
use FireflyIII\Models\Category;
|
||||||
use Input;
|
use Input;
|
||||||
|
|
||||||
@ -29,7 +28,7 @@ class CategoryFormRequest extends Request
|
|||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
// Only allow logged in users
|
// Only allow logged in users
|
||||||
return Auth::check();
|
return auth()->check();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -27,7 +27,7 @@ class ConfigurationRequest extends Request
|
|||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
// Only allow logged in users and admins
|
// 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;
|
namespace FireflyIII\Http\Requests;
|
||||||
|
|
||||||
use Auth;
|
|
||||||
use Input;
|
use Input;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,7 +27,7 @@ class CurrencyFormRequest extends Request
|
|||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
// Only allow logged in users
|
// Only allow logged in users
|
||||||
return Auth::check();
|
return auth()->check();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,8 +11,6 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Requests;
|
namespace FireflyIII\Http\Requests;
|
||||||
|
|
||||||
use Auth;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class DeleteAccountFormRequest
|
* Class DeleteAccountFormRequest
|
||||||
*
|
*
|
||||||
@ -27,7 +25,7 @@ class DeleteAccountFormRequest extends Request
|
|||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
// Only allow logged in users
|
// Only allow logged in users
|
||||||
return Auth::check();
|
return auth()->check();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,7 +11,6 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Requests;
|
namespace FireflyIII\Http\Requests;
|
||||||
|
|
||||||
use Auth;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,7 +27,7 @@ class ExportFormRequest extends Request
|
|||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
// Only allow logged in users
|
// Only allow logged in users
|
||||||
return Auth::check();
|
return auth()->check();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,8 +11,6 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Requests;
|
namespace FireflyIII\Http\Requests;
|
||||||
|
|
||||||
use Auth;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ImportUploadRequest
|
* Class ImportUploadRequest
|
||||||
*
|
*
|
||||||
@ -27,7 +25,7 @@ class ImportUploadRequest extends Request
|
|||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
// Only allow logged in users
|
// Only allow logged in users
|
||||||
return Auth::check();
|
return auth()->check();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,7 +32,7 @@ class JournalFormRequest extends Request
|
|||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
// Only allow logged in users
|
// Only allow logged in users
|
||||||
return Auth::check();
|
return auth()->check();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,8 +11,6 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Requests;
|
namespace FireflyIII\Http\Requests;
|
||||||
|
|
||||||
use Auth;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class MassDeleteJournalRequest
|
* Class MassDeleteJournalRequest
|
||||||
*
|
*
|
||||||
@ -27,7 +25,7 @@ class MassDeleteJournalRequest extends Request
|
|||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
// Only allow logged in users
|
// Only allow logged in users
|
||||||
return Auth::check();
|
return auth()->check();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,8 +11,6 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Requests;
|
namespace FireflyIII\Http\Requests;
|
||||||
|
|
||||||
use Auth;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class MassEditJournalRequest
|
* Class MassEditJournalRequest
|
||||||
*
|
*
|
||||||
@ -27,7 +25,7 @@ class MassEditJournalRequest extends Request
|
|||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
// Only allow logged in users
|
// Only allow logged in users
|
||||||
return Auth::check();
|
return auth()->check();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,8 +11,6 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Requests;
|
namespace FireflyIII\Http\Requests;
|
||||||
|
|
||||||
use Auth;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class NewUserFormRequest
|
* Class NewUserFormRequest
|
||||||
*
|
*
|
||||||
@ -27,7 +25,7 @@ class NewUserFormRequest extends Request
|
|||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
// Only allow logged in users
|
// Only allow logged in users
|
||||||
return Auth::check();
|
return auth()->check();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,7 +11,6 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Requests;
|
namespace FireflyIII\Http\Requests;
|
||||||
|
|
||||||
use Auth;
|
|
||||||
use Input;
|
use Input;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,7 +27,7 @@ class PiggyBankFormRequest extends Request
|
|||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
// Only allow logged in users
|
// Only allow logged in users
|
||||||
return Auth::check();
|
return auth()->check();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,8 +11,6 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Requests;
|
namespace FireflyIII\Http\Requests;
|
||||||
|
|
||||||
use Auth;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ProfileFormRequest
|
* Class ProfileFormRequest
|
||||||
*
|
*
|
||||||
@ -27,7 +25,7 @@ class ProfileFormRequest extends Request
|
|||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
// Only allow logged in users
|
// Only allow logged in users
|
||||||
return Auth::check();
|
return auth()->check();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,7 +11,6 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Requests;
|
namespace FireflyIII\Http\Requests;
|
||||||
|
|
||||||
use Auth;
|
|
||||||
use FireflyIII\Models\RuleGroup;
|
use FireflyIII\Models\RuleGroup;
|
||||||
use Input;
|
use Input;
|
||||||
|
|
||||||
@ -29,7 +28,7 @@ class RuleFormRequest extends Request
|
|||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
// Only allow logged in users
|
// Only allow logged in users
|
||||||
return Auth::check();
|
return auth()->check();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,7 +18,6 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Requests;
|
namespace FireflyIII\Http\Requests;
|
||||||
|
|
||||||
use Auth;
|
|
||||||
use FireflyIII\Models\RuleGroup;
|
use FireflyIII\Models\RuleGroup;
|
||||||
use Input;
|
use Input;
|
||||||
|
|
||||||
@ -36,7 +35,7 @@ class RuleGroupFormRequest extends Request
|
|||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
// Only allow logged in users
|
// Only allow logged in users
|
||||||
return Auth::check();
|
return auth()->check();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,7 +11,6 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Requests;
|
namespace FireflyIII\Http\Requests;
|
||||||
|
|
||||||
use Auth;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,7 +27,7 @@ class SelectTransactionsRequest extends Request
|
|||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
// Only allow logged in users
|
// Only allow logged in users
|
||||||
return Auth::check();
|
return auth()->check();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,7 +11,6 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Requests;
|
namespace FireflyIII\Http\Requests;
|
||||||
|
|
||||||
use Auth;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
|
||||||
|
|
||||||
@ -28,7 +27,7 @@ class SplitJournalFormRequest extends Request
|
|||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
{
|
{
|
||||||
// Only allow logged in users
|
// Only allow logged in users
|
||||||
return Auth::check();
|
return auth()->check();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
declare(strict_types = 1);
|
declare(strict_types = 1);
|
||||||
namespace FireflyIII\Http\Requests;
|
namespace FireflyIII\Http\Requests;
|
||||||
|
|
||||||
use Auth;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Models\Tag;
|
use FireflyIII\Models\Tag;
|
||||||
use Input;
|
use Input;
|
||||||
@ -29,7 +28,7 @@ class TagFormRequest extends Request
|
|||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
// Only allow logged in users
|
// Only allow logged in users
|
||||||
return Auth::check();
|
return auth()->check();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,8 +11,6 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Requests;
|
namespace FireflyIII\Http\Requests;
|
||||||
|
|
||||||
use Auth;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class RuleFormRequest
|
* Class RuleFormRequest
|
||||||
*
|
*
|
||||||
@ -27,7 +25,7 @@ class TestRuleFormRequest extends Request
|
|||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
// Only allow logged in users
|
// Only allow logged in users
|
||||||
return Auth::check();
|
return auth()->check();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,8 +11,6 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Requests;
|
namespace FireflyIII\Http\Requests;
|
||||||
|
|
||||||
use Auth;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class TokenFormRequest
|
* Class TokenFormRequest
|
||||||
*
|
*
|
||||||
@ -27,7 +25,7 @@ class TokenFormRequest extends Request
|
|||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
// Only allow logged in users
|
// 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)
|
public static function routeBinder(Account $value)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (Auth::check()) {
|
if (auth()->check()) {
|
||||||
if ($value->user_id == Auth::user()->id) {
|
if ($value->user_id == Auth::user()->id) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ class Attachment extends Model
|
|||||||
*/
|
*/
|
||||||
public static function routeBinder(Attachment $value)
|
public static function routeBinder(Attachment $value)
|
||||||
{
|
{
|
||||||
if (Auth::check()) {
|
if (auth()->check()) {
|
||||||
|
|
||||||
if ($value->user_id == Auth::user()->id) {
|
if ($value->user_id == Auth::user()->id) {
|
||||||
return $value;
|
return $value;
|
||||||
|
@ -81,7 +81,7 @@ class Bill extends Model
|
|||||||
*/
|
*/
|
||||||
public static function routeBinder(Bill $value)
|
public static function routeBinder(Bill $value)
|
||||||
{
|
{
|
||||||
if (Auth::check()) {
|
if (auth()->check()) {
|
||||||
if ($value->user_id == Auth::user()->id) {
|
if ($value->user_id == Auth::user()->id) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ class Budget extends Model
|
|||||||
*/
|
*/
|
||||||
public static function routeBinder(Budget $value)
|
public static function routeBinder(Budget $value)
|
||||||
{
|
{
|
||||||
if (Auth::check()) {
|
if (auth()->check()) {
|
||||||
if ($value->user_id == Auth::user()->id) {
|
if ($value->user_id == Auth::user()->id) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ class Category extends Model
|
|||||||
*/
|
*/
|
||||||
public static function routeBinder(Category $value)
|
public static function routeBinder(Category $value)
|
||||||
{
|
{
|
||||||
if (Auth::check()) {
|
if (auth()->check()) {
|
||||||
if ($value->user_id == Auth::user()->id) {
|
if ($value->user_id == Auth::user()->id) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ class ExportJob extends Model
|
|||||||
*/
|
*/
|
||||||
public static function routeBinder($value)
|
public static function routeBinder($value)
|
||||||
{
|
{
|
||||||
if (Auth::check()) {
|
if (auth()->check()) {
|
||||||
$model = self::where('key', $value)->where('user_id', Auth::user()->id)->first();
|
$model = self::where('key', $value)->where('user_id', Auth::user()->id)->first();
|
||||||
if (!is_null($model)) {
|
if (!is_null($model)) {
|
||||||
return $model;
|
return $model;
|
||||||
|
@ -62,7 +62,7 @@ class ImportJob extends Model
|
|||||||
*/
|
*/
|
||||||
public static function routeBinder($value)
|
public static function routeBinder($value)
|
||||||
{
|
{
|
||||||
if (Auth::check()) {
|
if (auth()->check()) {
|
||||||
$model = self::where('key', $value)->where('user_id', Auth::user()->id)->first();
|
$model = self::where('key', $value)->where('user_id', Auth::user()->id)->first();
|
||||||
if (!is_null($model)) {
|
if (!is_null($model)) {
|
||||||
return $model;
|
return $model;
|
||||||
|
@ -54,7 +54,7 @@ class LimitRepetition extends Model
|
|||||||
*/
|
*/
|
||||||
public static function routeBinder($value)
|
public static function routeBinder($value)
|
||||||
{
|
{
|
||||||
if (Auth::check()) {
|
if (auth()->check()) {
|
||||||
$object = LimitRepetition::where('limit_repetitions.id', $value)
|
$object = LimitRepetition::where('limit_repetitions.id', $value)
|
||||||
->leftJoin('budget_limits', 'budget_limits.id', '=', 'limit_repetitions.budget_limit_id')
|
->leftJoin('budget_limits', 'budget_limits.id', '=', 'limit_repetitions.budget_limit_id')
|
||||||
->leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id')
|
->leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id')
|
||||||
|
@ -70,7 +70,7 @@ class PiggyBank extends Model
|
|||||||
*/
|
*/
|
||||||
public static function routeBinder(PiggyBank $value)
|
public static function routeBinder(PiggyBank $value)
|
||||||
{
|
{
|
||||||
if (Auth::check()) {
|
if (auth()->check()) {
|
||||||
if ($value->account->user_id == Auth::user()->id) {
|
if ($value->account->user_id == Auth::user()->id) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ class Rule extends Model
|
|||||||
*/
|
*/
|
||||||
public static function routeBinder(Rule $value)
|
public static function routeBinder(Rule $value)
|
||||||
{
|
{
|
||||||
if (Auth::check()) {
|
if (auth()->check()) {
|
||||||
if ($value->user_id == Auth::user()->id) {
|
if ($value->user_id == Auth::user()->id) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ class RuleGroup extends Model
|
|||||||
*/
|
*/
|
||||||
public static function routeBinder(RuleGroup $value)
|
public static function routeBinder(RuleGroup $value)
|
||||||
{
|
{
|
||||||
if (Auth::check()) {
|
if (auth()->check()) {
|
||||||
if ($value->user_id == Auth::user()->id) {
|
if ($value->user_id == Auth::user()->id) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ class Tag extends TagSupport
|
|||||||
*/
|
*/
|
||||||
public static function routeBinder(Tag $value)
|
public static function routeBinder(Tag $value)
|
||||||
{
|
{
|
||||||
if (Auth::check()) {
|
if (auth()->check()) {
|
||||||
if ($value->user_id == Auth::user()->id) {
|
if ($value->user_id == Auth::user()->id) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace FireflyIII\Models;
|
namespace FireflyIII\Models;
|
||||||
|
|
||||||
use Auth;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
@ -53,7 +52,7 @@ class TransactionCurrency extends Model
|
|||||||
*/
|
*/
|
||||||
public static function routeBinder(TransactionCurrency $currency)
|
public static function routeBinder(TransactionCurrency $currency)
|
||||||
{
|
{
|
||||||
if (Auth::check()) {
|
if (auth()->check()) {
|
||||||
return $currency;
|
return $currency;
|
||||||
}
|
}
|
||||||
throw new NotFoundHttpException;
|
throw new NotFoundHttpException;
|
||||||
|
@ -128,7 +128,7 @@ class TransactionJournal extends TransactionJournalSupport
|
|||||||
*/
|
*/
|
||||||
public static function routeBinder($value)
|
public static function routeBinder($value)
|
||||||
{
|
{
|
||||||
if (Auth::check()) {
|
if (auth()->check()) {
|
||||||
$validTypes = [TransactionType::WITHDRAWAL, TransactionType::DEPOSIT, TransactionType::TRANSFER];
|
$validTypes = [TransactionType::WITHDRAWAL, TransactionType::DEPOSIT, TransactionType::TRANSFER];
|
||||||
$object = TransactionJournal::where('transaction_journals.id', $value)
|
$object = TransactionJournal::where('transaction_journals.id', $value)
|
||||||
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
|
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
|
||||||
@ -380,7 +380,8 @@ class TransactionJournal extends TransactionJournalSupport
|
|||||||
'transaction_journals.completed',
|
'transaction_journals.completed',
|
||||||
'transaction_types.type',
|
'transaction_types.type',
|
||||||
'transaction_currencies.code',
|
'transaction_currencies.code',
|
||||||
]);
|
]
|
||||||
|
);
|
||||||
$query->with(['categories', 'budgets', 'attachments', 'bill', 'transactions']);
|
$query->with(['categories', 'budgets', 'attachments', 'bill', 'transactions']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
namespace FireflyIII\Providers;
|
namespace FireflyIII\Providers;
|
||||||
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
|
||||||
use Illuminate\Support\Facades\Broadcast;
|
use Illuminate\Support\Facades\Broadcast;
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
class BroadcastServiceProvider extends ServiceProvider
|
class BroadcastServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
@ -19,8 +19,10 @@ class BroadcastServiceProvider extends ServiceProvider
|
|||||||
/*
|
/*
|
||||||
* Authenticate the user's personal channel...
|
* Authenticate the user's personal channel...
|
||||||
*/
|
*/
|
||||||
Broadcast::channel('App.User.*', function ($user, $userId) {
|
Broadcast::channel(
|
||||||
|
'App.User.*', function ($user, $userId) {
|
||||||
return (int)$user->id === (int)$userId;
|
return (int)$user->id === (int)$userId;
|
||||||
});
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
namespace FireflyIII\Providers;
|
namespace FireflyIII\Providers;
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Route;
|
|
||||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
class RouteServiceProvider extends ServiceProvider
|
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.
|
* Define the "api" routes for the application.
|
||||||
*
|
*
|
||||||
@ -68,12 +51,33 @@ class RouteServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
protected function mapApiRoutes()
|
protected function mapApiRoutes()
|
||||||
{
|
{
|
||||||
Route::group([
|
Route::group(
|
||||||
|
[
|
||||||
'middleware' => 'api',
|
'middleware' => 'api',
|
||||||
'namespace' => $this->namespace,
|
'namespace' => $this->namespace,
|
||||||
'prefix' => 'api',
|
'prefix' => 'api',
|
||||||
], function ($router) {
|
], function ($router) {
|
||||||
require base_path('routes/api.php');
|
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.account_id as destination_account_id';
|
||||||
$fields[] = 'destination.amount as destination_amount';
|
$fields[] = 'destination.amount as destination_amount';
|
||||||
|
|
||||||
$query->groupBy(['source.account_id',
|
$query->groupBy(
|
||||||
|
['source.account_id',
|
||||||
'source.amount',
|
'source.amount',
|
||||||
'destination.account_id',
|
'destination.account_id',
|
||||||
'destination.amount',]);
|
'destination.amount',]
|
||||||
|
);
|
||||||
|
|
||||||
$complete = $query->get($fields);
|
$complete = $query->get($fields);
|
||||||
|
|
||||||
|
@ -115,6 +115,4 @@ class AbstractTrigger
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ class AccountList implements BinderInterface
|
|||||||
public static function routeBinder($value, $route): Collection
|
public static function routeBinder($value, $route): Collection
|
||||||
{
|
{
|
||||||
|
|
||||||
if (Auth::check()) {
|
if (auth()->check()) {
|
||||||
|
|
||||||
$ids = explode(',', $value);
|
$ids = explode(',', $value);
|
||||||
// filter ids:
|
// filter ids:
|
||||||
|
@ -33,7 +33,7 @@ class BudgetList implements BinderInterface
|
|||||||
*/
|
*/
|
||||||
public static function routeBinder($value, $route): Collection
|
public static function routeBinder($value, $route): Collection
|
||||||
{
|
{
|
||||||
if (Auth::check()) {
|
if (auth()->check()) {
|
||||||
$ids = explode(',', $value);
|
$ids = explode(',', $value);
|
||||||
/** @var \Illuminate\Support\Collection $object */
|
/** @var \Illuminate\Support\Collection $object */
|
||||||
$object = Budget::where('active', 1)
|
$object = Budget::where('active', 1)
|
||||||
|
@ -32,7 +32,7 @@ class CategoryList implements BinderInterface
|
|||||||
*/
|
*/
|
||||||
public static function routeBinder($value, $route): Collection
|
public static function routeBinder($value, $route): Collection
|
||||||
{
|
{
|
||||||
if (Auth::check()) {
|
if (auth()->check()) {
|
||||||
$ids = explode(',', $value);
|
$ids = explode(',', $value);
|
||||||
/** @var \Illuminate\Support\Collection $object */
|
/** @var \Illuminate\Support\Collection $object */
|
||||||
$object = Category::whereIn('id', $ids)
|
$object = Category::whereIn('id', $ids)
|
||||||
|
@ -32,7 +32,7 @@ class JournalList implements BinderInterface
|
|||||||
*/
|
*/
|
||||||
public static function routeBinder($value, $route): Collection
|
public static function routeBinder($value, $route): Collection
|
||||||
{
|
{
|
||||||
if (Auth::check()) {
|
if (auth()->check()) {
|
||||||
$ids = explode(',', $value);
|
$ids = explode(',', $value);
|
||||||
/** @var \Illuminate\Support\Collection $object */
|
/** @var \Illuminate\Support\Collection $object */
|
||||||
$object = TransactionJournal::whereIn('transaction_journals.id', $ids)
|
$object = TransactionJournal::whereIn('transaction_journals.id', $ids)
|
||||||
|
@ -32,7 +32,7 @@ class UnfinishedJournal implements BinderInterface
|
|||||||
*/
|
*/
|
||||||
public static function routeBinder($value, $route): TransactionJournal
|
public static function routeBinder($value, $route): TransactionJournal
|
||||||
{
|
{
|
||||||
if (Auth::check()) {
|
if (auth()->check()) {
|
||||||
$object = TransactionJournal::where('transaction_journals.id', $value)
|
$object = TransactionJournal::where('transaction_journals.id', $value)
|
||||||
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
|
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
|
||||||
->where('completed', 0)
|
->where('completed', 0)
|
||||||
|
@ -38,7 +38,7 @@ class CacheProperties
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->properties = new Collection;
|
$this->properties = new Collection;
|
||||||
if (Auth::check()) {
|
if (auth()->check()) {
|
||||||
$this->addProperty(Auth::user()->id);
|
$this->addProperty(Auth::user()->id);
|
||||||
$this->addProperty(Prefs::lastActivity());
|
$this->addProperty(Prefs::lastActivity());
|
||||||
}
|
}
|
||||||
|
@ -224,7 +224,7 @@ class FireflyValidator extends Validator
|
|||||||
public function validateUniqueAccountForUser($attribute, $value, $parameters): bool
|
public function validateUniqueAccountForUser($attribute, $value, $parameters): bool
|
||||||
{
|
{
|
||||||
// because a user does not have to be logged in (tests and what-not).
|
// because a user does not have to be logged in (tests and what-not).
|
||||||
if (!Auth::check()) {
|
if (!auth()->check()) {
|
||||||
return $this->validateAccountAnonymously();
|
return $this->validateAccountAnonymously();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user