Various code cleanup.

This commit is contained in:
James Cole
2018-08-04 17:30:06 +02:00
parent 5af026674f
commit f0d3ca5d53
88 changed files with 552 additions and 311 deletions

View File

@@ -26,6 +26,7 @@ use Carbon\Carbon;
use Crypt;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\MorphMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -67,18 +68,18 @@ class PiggyBank extends Model
'active' => 'boolean',
'encrypted' => 'boolean',
];
/** @var array */
protected $dates = ['startdate', 'targetdate'];
/** @var array */
/** @var array Fields that can be filled */
protected $fillable = ['name', 'account_id', 'order', 'targetamount', 'startdate', 'targetdate', 'active'];
/** @var array */
/** @var array Hidden from view */
protected $hidden = ['targetamount_encrypted', 'encrypted'];
/**
* Route binder. Converts the key in the URL to the specified object (or throw 404).
*
* @param string $value
*
* @return PiggyBank
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
* @throws NotFoundHttpException
*/
public static function routeBinder(string $value): PiggyBank
{
@@ -96,7 +97,7 @@ class PiggyBank extends Model
/**
* @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
* @return BelongsTo
*/
public function account(): BelongsTo
{
@@ -131,18 +132,18 @@ class PiggyBank extends Model
/**
* @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\HasMany
* @return HasMany
*/
public function piggyBankEvents(): \Illuminate\Database\Eloquent\Relations\HasMany
public function piggyBankEvents(): HasMany
{
return $this->hasMany(PiggyBankEvent::class);
}
/**
* @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\HasMany
* @return HasMany
*/
public function piggyBankRepetitions(): \Illuminate\Database\Eloquent\Relations\HasMany
public function piggyBankRepetitions(): HasMany
{
return $this->hasMany(PiggyBankRepetition::class);
}