Code clean up

This commit is contained in:
James Cole
2016-09-16 12:15:58 +02:00
parent f38984398d
commit d25d0454fc
52 changed files with 135 additions and 185 deletions

View File

@@ -11,7 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Models;
use Auth;
use Crypt;
use FireflyIII\Exceptions\FireflyException;
use Illuminate\Contracts\Encryption\DecryptException;
@@ -154,7 +153,7 @@ class Account extends Model
{
if (auth()->check()) {
if ($value->user_id == Auth::user()->id) {
if ($value->user_id == auth()->user()->id) {
return $value;
}
}

View File

@@ -11,7 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Models;
use Auth;
use Crypt;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
@@ -71,7 +70,7 @@ class Attachment extends Model
{
if (auth()->check()) {
if ($value->user_id == Auth::user()->id) {
if ($value->user_id == auth()->user()->id) {
return $value;
}
}

View File

@@ -11,7 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Models;
use Auth;
use Crypt;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
@@ -82,7 +81,7 @@ class Bill extends Model
public static function routeBinder(Bill $value)
{
if (auth()->check()) {
if ($value->user_id == Auth::user()->id) {
if ($value->user_id == auth()->user()->id) {
return $value;
}
}

View File

@@ -11,7 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Models;
use Auth;
use Crypt;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
@@ -95,7 +94,7 @@ class Budget extends Model
public static function routeBinder(Budget $value)
{
if (auth()->check()) {
if ($value->user_id == Auth::user()->id) {
if ($value->user_id == auth()->user()->id) {
return $value;
}
}

View File

@@ -11,7 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Models;
use Auth;
use Crypt;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
@@ -90,7 +89,7 @@ class Category extends Model
public static function routeBinder(Category $value)
{
if (auth()->check()) {
if ($value->user_id == Auth::user()->id) {
if ($value->user_id == auth()->user()->id) {
return $value;
}
}

View File

@@ -11,7 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Models;
use Auth;
use Illuminate\Database\Eloquent\Model;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -45,7 +44,7 @@ class ExportJob extends Model
public static function routeBinder($value)
{
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)) {
return $model;
}

View File

@@ -11,7 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Models;
use Auth;
use Crypt;
use Illuminate\Database\Eloquent\Model;
use Storage;
@@ -63,7 +62,7 @@ class ImportJob extends Model
public static function routeBinder($value)
{
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)) {
return $model;
}

View File

@@ -11,7 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Models;
use Auth;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
@@ -58,7 +57,7 @@ class LimitRepetition extends Model
$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')
->where('budgets.user_id', Auth::user()->id)
->where('budgets.user_id', auth()->user()->id)
->first(['limit_repetitions.*']);
if ($object) {
return $object;

View File

@@ -11,7 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Models;
use Auth;
use Crypt;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
@@ -71,7 +70,7 @@ class PiggyBank extends Model
public static function routeBinder(PiggyBank $value)
{
if (auth()->check()) {
if ($value->account->user_id == Auth::user()->id) {
if ($value->account->user_id == auth()->user()->id) {
return $value;
}
}

View File

@@ -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;
@@ -60,7 +59,7 @@ class Rule extends Model
public static function routeBinder(Rule $value)
{
if (auth()->check()) {
if ($value->user_id == Auth::user()->id) {
if ($value->user_id == auth()->user()->id) {
return $value;
}
}

View File

@@ -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;
@@ -56,7 +55,7 @@ class RuleGroup extends Model
public static function routeBinder(RuleGroup $value)
{
if (auth()->check()) {
if ($value->user_id == Auth::user()->id) {
if ($value->user_id == auth()->user()->id) {
return $value;
}
}

View File

@@ -11,7 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Models;
use Auth;
use Crypt;
use FireflyIII\Support\Models\TagSupport;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -97,7 +96,7 @@ class Tag extends TagSupport
public static function routeBinder(Tag $value)
{
if (auth()->check()) {
if ($value->user_id == Auth::user()->id) {
if ($value->user_id == auth()->user()->id) {
return $value;
}
}

View File

@@ -11,7 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Models;
use Auth;
use Carbon\Carbon;
use Crypt;
use FireflyIII\Support\CacheProperties;
@@ -133,7 +132,7 @@ class TransactionJournal extends TransactionJournalSupport
$object = TransactionJournal::where('transaction_journals.id', $value)
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
->whereIn('transaction_types.type', $validTypes)
->where('user_id', Auth::user()->id)->first(['transaction_journals.*']);
->where('user_id', auth()->user()->id)->first(['transaction_journals.*']);
if ($object) {
return $object;
}