mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-29 18:20:01 +00:00
Code clean up [skip ci]
This commit is contained in:
@@ -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']);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user