Fix various code style issues.

This commit is contained in:
James Cole
2016-12-15 21:35:33 +01:00
parent e247aace8d
commit 1b4d55cca4
12 changed files with 24 additions and 28 deletions

View File

@@ -61,7 +61,7 @@ class Account extends Model
public static function firstOrCreateEncrypted(array $fields)
{
// everything but the name:
$query = Account::orderBy('id');
$query = self::orderBy('id');
$search = $fields;
unset($search['name'], $search['iban']);
@@ -81,7 +81,7 @@ class Account extends Model
}
// create it!
$account = Account::create($fields);
$account = self::create($fields);
return $account;

View File

@@ -43,7 +43,7 @@ class Budget extends Model
public static function firstOrCreateEncrypted(array $fields)
{
// everything but the name:
$query = Budget::orderBy('id');
$query = self::orderBy('id');
$search = $fields;
unset($search['name']);
foreach ($search as $name => $value) {
@@ -57,7 +57,7 @@ class Budget extends Model
}
}
// create it!
$budget = Budget::create($fields);
$budget = self::create($fields);
return $budget;

View File

@@ -42,7 +42,7 @@ class Category extends Model
public static function firstOrCreateEncrypted(array $fields)
{
// everything but the name:
$query = Category::orderBy('id');
$query = self::orderBy('id');
$search = $fields;
unset($search['name']);
foreach ($search as $name => $value) {
@@ -56,7 +56,7 @@ class Category extends Model
}
}
// create it!
$category = Category::create($fields);
$category = self::create($fields);
return $category;

View File

@@ -37,7 +37,7 @@ class LimitRepetition extends Model
public static function routeBinder($value)
{
if (auth()->check()) {
$object = LimitRepetition::where('limit_repetitions.id', $value)
$object = self::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)

View File

@@ -43,7 +43,7 @@ class Tag extends TagSupport
$search = $fields;
unset($search['tag']);
$query = Tag::orderBy('id');
$query = self::orderBy('id');
foreach ($search as $name => $value) {
$query->where($name, $value);
}
@@ -57,7 +57,7 @@ class Tag extends TagSupport
// create it!
$fields['tagMode'] = 'nothing';
$fields['description'] = $fields['description'] ?? '';
$tag = Tag::create($fields);
$tag = self::create($fields);
return $tag;

View File

@@ -64,7 +64,7 @@ class TransactionJournal extends TransactionJournalSupport
public static function routeBinder($value)
{
if (auth()->check()) {
$object = TransactionJournal::where('transaction_journals.id', $value)
$object = self::where('transaction_journals.id', $value)
->with('transactionType')
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
->where('user_id', auth()->user()->id)->first(['transaction_journals.*']);

View File

@@ -57,7 +57,7 @@ class TransactionType extends Model
*/
public function isDeposit()
{
return $this->type === TransactionType::DEPOSIT;
return $this->type === self::DEPOSIT;
}
/**
@@ -65,7 +65,7 @@ class TransactionType extends Model
*/
public function isOpeningBalance()
{
return $this->type === TransactionType::OPENING_BALANCE;
return $this->type === self::OPENING_BALANCE;
}
/**
@@ -73,7 +73,7 @@ class TransactionType extends Model
*/
public function isTransfer()
{
return $this->type === TransactionType::TRANSFER;
return $this->type === self::TRANSFER;
}
/**
@@ -81,7 +81,7 @@ class TransactionType extends Model
*/
public function isWithdrawal()
{
return $this->type === TransactionType::WITHDRAWAL;
return $this->type === self::WITHDRAWAL;
}
/**