chore: code cleanup.

This commit is contained in:
James Cole
2023-05-29 13:56:55 +02:00
parent 7f7644c92f
commit 1b52147a05
295 changed files with 12418 additions and 12324 deletions

View File

@@ -160,6 +160,30 @@ class TransactionJournal extends Model
/** @var array Hidden from view */
protected $hidden = ['encrypted'];
/**
* Checks if tables are joined.
*
*
* @param Builder $query
* @param string $table
*
* @return bool
*/
public static function isJoined(Builder $query, string $table): bool
{
$joins = $query->getQuery()->joins;
if (null === $joins) {
return false;
}
foreach ($joins as $join) {
if ($join->table === $table) {
return true;
}
}
return false;
}
/**
* Route binder. Converts the key in the URL to the specified object (or throw 404).
*
@@ -184,14 +208,6 @@ class TransactionJournal extends Model
throw new NotFoundHttpException();
}
/**
* @return BelongsTo
*/
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
/**
* @return MorphMany
*/
@@ -307,30 +323,6 @@ class TransactionJournal extends Model
}
}
/**
* Checks if tables are joined.
*
*
* @param Builder $query
* @param string $table
*
* @return bool
*/
public static function isJoined(Builder $query, string $table): bool
{
$joins = $query->getQuery()->joins;
if (null === $joins) {
return false;
}
foreach ($joins as $join) {
if ($join->table === $table) {
return true;
}
}
return false;
}
/**
* @return HasMany
*/
@@ -386,4 +378,12 @@ class TransactionJournal extends Model
{
return $this->hasMany(Transaction::class);
}
/**
* @return BelongsTo
*/
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
}