Code cleanup that (hopefully) matches style CI

This commit is contained in:
James Cole
2020-03-17 16:46:00 +01:00
parent 91c067ac9f
commit 9a25d6a741
42 changed files with 1395 additions and 1262 deletions

View File

@@ -23,54 +23,57 @@ declare(strict_types=1);
namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
use Illuminate\Database\Eloquent\Collection;
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 Illuminate\Database\Query\Builder;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* Class PiggyBank.
*
* @property Carbon $targetdate
* @property Carbon $startdate
* @property string $targetamount
* @property int $id
* @property string $name
* @property Account $account
* @property Carbon $updated_at
* @property Carbon $created_at
* @property int $order
* @property bool $active
* @property int $account_id
* @property bool encrypted
* @property \Illuminate\Support\Carbon|null $deleted_at
* @property bool $encrypted
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Note[] $notes
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBankEvent[] $piggyBankEvents
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBankRepetition[] $piggyBankRepetitions
* @property Carbon $targetdate
* @property Carbon $startdate
* @property string $targetamount
* @property int $id
* @property string $name
* @property Account $account
* @property Carbon $updated_at
* @property Carbon $created_at
* @property int $order
* @property bool $active
* @property int $account_id
* @property bool encrypted
* @property \Illuminate\Support\Carbon|null $deleted_at
* @property bool $encrypted
* @property-read Collection|Note[] $notes
* @property-read Collection|PiggyBankEvent[] $piggyBankEvents
* @property-read Collection|PiggyBankRepetition[] $piggyBankRepetitions
* @method static bool|null forceDelete()
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\PiggyBank newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\PiggyBank newQuery()
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank onlyTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\PiggyBank query()
* @method static \Illuminate\Database\Eloquent\Builder|PiggyBank newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|PiggyBank newQuery()
* @method static Builder|PiggyBank onlyTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|PiggyBank query()
* @method static bool|null restore()
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\PiggyBank whereAccountId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\PiggyBank whereActive($value)
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\PiggyBank whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\PiggyBank whereDeletedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\PiggyBank whereEncrypted($value)
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\PiggyBank whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\PiggyBank whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\PiggyBank whereOrder($value)
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\PiggyBank whereStartdate($value)
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\PiggyBank whereTargetamount($value)
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\PiggyBank whereTargetdate($value)
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\PiggyBank whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank withTrashed()
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank withoutTrashed()
* @mixin \Eloquent
* @method static \Illuminate\Database\Eloquent\Builder|PiggyBank whereAccountId($value)
* @method static \Illuminate\Database\Eloquent\Builder|PiggyBank whereActive($value)
* @method static \Illuminate\Database\Eloquent\Builder|PiggyBank whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|PiggyBank whereDeletedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|PiggyBank whereEncrypted($value)
* @method static \Illuminate\Database\Eloquent\Builder|PiggyBank whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|PiggyBank whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder|PiggyBank whereOrder($value)
* @method static \Illuminate\Database\Eloquent\Builder|PiggyBank whereStartdate($value)
* @method static \Illuminate\Database\Eloquent\Builder|PiggyBank whereTargetamount($value)
* @method static \Illuminate\Database\Eloquent\Builder|PiggyBank whereTargetdate($value)
* @method static \Illuminate\Database\Eloquent\Builder|PiggyBank whereUpdatedAt($value)
* @method static Builder|PiggyBank withTrashed()
* @method static Builder|PiggyBank withoutTrashed()
* @mixin Eloquent
*/
class PiggyBank extends Model
{
@@ -102,13 +105,13 @@ class PiggyBank extends Model
*
* @param string $value
*
* @return PiggyBank
* @throws NotFoundHttpException
* @return PiggyBank
*/
public static function routeBinder(string $value): PiggyBank
{
if (auth()->check()) {
$piggyBankId = (int)$value;
$piggyBankId = (int) $value;
$piggyBank = self::where('piggy_banks.id', $piggyBankId)
->leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id')
->where('accounts.user_id', auth()->user()->id)->first(['piggy_banks.*']);
@@ -162,6 +165,6 @@ class PiggyBank extends Model
*/
public function setTargetamountAttribute($value): void
{
$this->attributes['targetamount'] = (string)$value;
$this->attributes['targetamount'] = (string) $value;
}
}