mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Minor code cleanup.
This commit is contained in:
parent
92f7a9c574
commit
a14c9438ad
@ -39,8 +39,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
/**
|
/**
|
||||||
* Class Account
|
* Class Account
|
||||||
*
|
*
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property \Illuminate\Support\Carbon|null $created_at
|
* @property \Illuminate\Support\Carbon|null $created_at
|
||||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||||
* @property \Illuminate\Support\Carbon|null $deleted_at
|
* @property \Illuminate\Support\Carbon|null $deleted_at
|
||||||
* @property int $user_id
|
* @property int $user_id
|
||||||
@ -89,16 +89,16 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
* @method static Builder|Account withTrashed()
|
* @method static Builder|Account withTrashed()
|
||||||
* @method static Builder|Account withoutTrashed()
|
* @method static Builder|Account withoutTrashed()
|
||||||
* @mixin Eloquent
|
* @mixin Eloquent
|
||||||
* @property Carbon $lastActivityDate
|
* @property Carbon $lastActivityDate
|
||||||
* @property string $startBalance
|
* @property string $startBalance
|
||||||
* @property string $endBalance
|
* @property string $endBalance
|
||||||
* @property string $difference
|
* @property string $difference
|
||||||
* @property string $interest
|
* @property string $interest
|
||||||
* @property string $interestPeriod
|
* @property string $interestPeriod
|
||||||
* @property string $accountTypeString
|
* @property string $accountTypeString
|
||||||
* @property string $location
|
* @property string $location
|
||||||
* @property string $liability_direction
|
* @property string $liability_direction
|
||||||
* @property string $current_debt
|
* @property string $current_debt
|
||||||
*/
|
*/
|
||||||
class Account extends Model
|
class Account extends Model
|
||||||
{
|
{
|
||||||
@ -149,11 +149,12 @@ class Account extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all of the tags for the post.
|
* @return BelongsTo
|
||||||
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
public function objectGroups()
|
public function accountType(): BelongsTo
|
||||||
{
|
{
|
||||||
return $this->morphToMany(ObjectGroup::class, 'object_groupable');
|
return $this->belongsTo(AccountType::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -165,24 +166,6 @@ class Account extends Model
|
|||||||
return $this->morphMany(Attachment::class, 'attachable');
|
return $this->morphMany(Attachment::class, 'attachable');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return HasMany
|
|
||||||
* @codeCoverageIgnore
|
|
||||||
*/
|
|
||||||
public function accountMeta(): HasMany
|
|
||||||
{
|
|
||||||
return $this->hasMany(AccountMeta::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return BelongsTo
|
|
||||||
* @codeCoverageIgnore
|
|
||||||
*/
|
|
||||||
public function accountType(): BelongsTo
|
|
||||||
{
|
|
||||||
return $this->belongsTo(AccountType::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the account number.
|
* Get the account number.
|
||||||
*
|
*
|
||||||
@ -198,6 +181,15 @@ class Account extends Model
|
|||||||
return $metaValue ? $metaValue->data : '';
|
return $metaValue ? $metaValue->data : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return HasMany
|
||||||
|
* @codeCoverageIgnore
|
||||||
|
*/
|
||||||
|
public function accountMeta(): HasMany
|
||||||
|
{
|
||||||
|
return $this->hasMany(AccountMeta::class);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
@ -231,6 +223,14 @@ class Account extends Model
|
|||||||
return $this->morphMany(Note::class, 'noteable');
|
return $this->morphMany(Note::class, 'noteable');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all of the tags for the post.
|
||||||
|
*/
|
||||||
|
public function objectGroups()
|
||||||
|
{
|
||||||
|
return $this->morphToMany(ObjectGroup::class, 'object_groupable');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return HasMany
|
* @return HasMany
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
|
@ -27,6 +27,7 @@ use Illuminate\Database\Eloquent\Builder;
|
|||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
|
use JsonException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class AccountMeta
|
* Class AccountMeta
|
||||||
@ -79,7 +80,7 @@ class AccountMeta extends Model
|
|||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
* @throws \JsonException
|
* @throws JsonException
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
public function getDataAttribute($value)
|
public function getDataAttribute($value)
|
||||||
|
@ -28,6 +28,7 @@ use Illuminate\Database\Eloquent\Collection;
|
|||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\AccountType
|
* FireflyIII\Models\AccountType
|
||||||
*
|
*
|
||||||
@ -74,7 +75,7 @@ class AccountType extends Model
|
|||||||
public const MORTGAGE = 'Mortgage';
|
public const MORTGAGE = 'Mortgage';
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public const CREDITCARD = 'Credit card';
|
public const CREDITCARD = 'Credit card';
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public const LIABILITY_CREDIT = 'Liability credit account';
|
public const LIABILITY_CREDIT = 'Liability credit account';
|
||||||
/**
|
/**
|
||||||
* The attributes that should be casted to native types.
|
* The attributes that should be casted to native types.
|
||||||
|
@ -37,12 +37,12 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
/**
|
/**
|
||||||
* FireflyIII\Models\Attachment
|
* FireflyIII\Models\Attachment
|
||||||
*
|
*
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property Carbon|null $created_at
|
* @property Carbon|null $created_at
|
||||||
* @property Carbon|null $updated_at
|
* @property Carbon|null $updated_at
|
||||||
* @property Carbon|null $deleted_at
|
* @property Carbon|null $deleted_at
|
||||||
* @property int $user_id
|
* @property int $user_id
|
||||||
* @property int $attachable_id
|
* @property int $attachable_id
|
||||||
* @property string $attachable_type
|
* @property string $attachable_type
|
||||||
* @property bool $file_exists
|
* @property bool $file_exists
|
||||||
* @property string $md5
|
* @property string $md5
|
||||||
|
@ -22,27 +22,27 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Models;
|
namespace FireflyIII\Models;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
|
||||||
use Eloquent;
|
use Eloquent;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Illuminate\Database\Query\Builder;
|
use Illuminate\Database\Query\Builder;
|
||||||
|
use Illuminate\Support\Carbon;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\AvailableBudget
|
* FireflyIII\Models\AvailableBudget
|
||||||
*
|
*
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property \Illuminate\Support\Carbon|null $created_at
|
* @property Carbon|null $created_at
|
||||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
* @property Carbon|null $updated_at
|
||||||
* @property \Illuminate\Support\Carbon|null $deleted_at
|
* @property Carbon|null $deleted_at
|
||||||
* @property int $user_id
|
* @property int $user_id
|
||||||
* @property int $transaction_currency_id
|
* @property int $transaction_currency_id
|
||||||
* @property string $amount
|
* @property string $amount
|
||||||
* @property \Illuminate\Support\Carbon $start_date
|
* @property Carbon $start_date
|
||||||
* @property \Illuminate\Support\Carbon $end_date
|
* @property Carbon $end_date
|
||||||
* @property-read TransactionCurrency $transactionCurrency
|
* @property-read TransactionCurrency $transactionCurrency
|
||||||
* @property-read User $user
|
* @property-read User $user
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|AvailableBudget newModelQuery()
|
* @method static \Illuminate\Database\Eloquent\Builder|AvailableBudget newModelQuery()
|
||||||
@ -65,6 +65,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
class AvailableBudget extends Model
|
class AvailableBudget extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that should be casted to native types.
|
* The attributes that should be casted to native types.
|
||||||
*
|
*
|
||||||
@ -87,13 +88,13 @@ class AvailableBudget extends Model
|
|||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value
|
||||||
*
|
*
|
||||||
* @throws NotFoundHttpException
|
|
||||||
* @return AvailableBudget
|
* @return AvailableBudget
|
||||||
|
* @throws NotFoundHttpException
|
||||||
*/
|
*/
|
||||||
public static function routeBinder(string $value): AvailableBudget
|
public static function routeBinder(string $value): AvailableBudget
|
||||||
{
|
{
|
||||||
if (auth()->check()) {
|
if (auth()->check()) {
|
||||||
$availableBudgetId = (int) $value;
|
$availableBudgetId = (int)$value;
|
||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
/** @var AvailableBudget $availableBudget */
|
/** @var AvailableBudget $availableBudget */
|
||||||
|
@ -39,9 +39,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
* FireflyIII\Models\Budget
|
* FireflyIII\Models\Budget
|
||||||
*
|
*
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property Carbon|null $created_at
|
* @property Carbon|null $created_at
|
||||||
* @property Carbon|null $updated_at
|
* @property Carbon|null $updated_at
|
||||||
* @property Carbon|null $deleted_at
|
* @property Carbon|null $deleted_at
|
||||||
* @property int $user_id
|
* @property int $user_id
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property bool $active
|
* @property bool $active
|
||||||
@ -74,7 +74,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
* @method static Builder|Budget withTrashed()
|
* @method static Builder|Budget withTrashed()
|
||||||
* @method static Builder|Budget withoutTrashed()
|
* @method static Builder|Budget withoutTrashed()
|
||||||
* @mixin Eloquent
|
* @mixin Eloquent
|
||||||
* @property string $email
|
* @property string $email
|
||||||
*/
|
*/
|
||||||
class Budget extends Model
|
class Budget extends Model
|
||||||
{
|
{
|
||||||
|
@ -22,23 +22,23 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Models;
|
namespace FireflyIII\Models;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
|
||||||
use Eloquent;
|
use Eloquent;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
use Illuminate\Support\Carbon;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\BudgetLimit
|
* FireflyIII\Models\BudgetLimit
|
||||||
*
|
*
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property \Illuminate\Support\Carbon|null $created_at
|
* @property Carbon|null $created_at
|
||||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
* @property Carbon|null $updated_at
|
||||||
* @property int $budget_id
|
* @property int $budget_id
|
||||||
* @property int|null $transaction_currency_id
|
* @property int|null $transaction_currency_id
|
||||||
* @property \Illuminate\Support\Carbon $start_date
|
* @property Carbon $start_date
|
||||||
* @property \Illuminate\Support\Carbon|null $end_date
|
* @property Carbon|null $end_date
|
||||||
* @property string $amount
|
* @property string $amount
|
||||||
* @property string $spent
|
* @property string $spent
|
||||||
* @property string|null $period
|
* @property string|null $period
|
||||||
|
@ -96,13 +96,13 @@ class Category extends Model
|
|||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value
|
||||||
*
|
*
|
||||||
* @throws NotFoundHttpException
|
|
||||||
* @return Category
|
* @return Category
|
||||||
|
* @throws NotFoundHttpException
|
||||||
*/
|
*/
|
||||||
public static function routeBinder(string $value): Category
|
public static function routeBinder(string $value): Category
|
||||||
{
|
{
|
||||||
if (auth()->check()) {
|
if (auth()->check()) {
|
||||||
$categoryId = (int) $value;
|
$categoryId = (int)$value;
|
||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
/** @var Category $category */
|
/** @var Category $category */
|
||||||
@ -114,14 +114,6 @@ class Category extends Model
|
|||||||
throw new NotFoundHttpException;
|
throw new NotFoundHttpException;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @codeCoverageIgnore
|
|
||||||
* @return BelongsToMany
|
|
||||||
*/
|
|
||||||
public function transactionJournals(): BelongsToMany
|
|
||||||
{
|
|
||||||
return $this->belongsToMany(TransactionJournal::class, 'category_transaction_journal', 'category_id');
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
* @return MorphMany
|
* @return MorphMany
|
||||||
@ -140,6 +132,15 @@ class Category extends Model
|
|||||||
return $this->morphMany(Note::class, 'noteable');
|
return $this->morphMany(Note::class, 'noteable');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @codeCoverageIgnore
|
||||||
|
* @return BelongsToMany
|
||||||
|
*/
|
||||||
|
public function transactionJournals(): BelongsToMany
|
||||||
|
{
|
||||||
|
return $this->belongsToMany(TransactionJournal::class, 'category_transaction_journal', 'category_id');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
* @return BelongsToMany
|
* @return BelongsToMany
|
||||||
|
@ -31,12 +31,12 @@ use Illuminate\Support\Carbon;
|
|||||||
/**
|
/**
|
||||||
* FireflyIII\Models\Configuration
|
* FireflyIII\Models\Configuration
|
||||||
*
|
*
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property Carbon|null $created_at
|
* @property Carbon|null $created_at
|
||||||
* @property Carbon|null $updated_at
|
* @property Carbon|null $updated_at
|
||||||
* @property Carbon|null $deleted_at
|
* @property Carbon|null $deleted_at
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property mixed $data
|
* @property mixed $data
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Configuration newModelQuery()
|
* @method static \Illuminate\Database\Eloquent\Builder|Configuration newModelQuery()
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Configuration newQuery()
|
* @method static \Illuminate\Database\Eloquent\Builder|Configuration newQuery()
|
||||||
* @method static Builder|Configuration onlyTrashed()
|
* @method static Builder|Configuration onlyTrashed()
|
||||||
@ -70,7 +70,8 @@ class Configuration extends Model
|
|||||||
protected $table = 'configuration';
|
protected $table = 'configuration';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See reference nr. 17
|
* See reference nr. 17
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*
|
*
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
|
@ -22,24 +22,24 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Models;
|
namespace FireflyIII\Models;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
|
||||||
use Eloquent;
|
use Eloquent;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
use Illuminate\Support\Carbon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\CurrencyExchangeRate
|
* FireflyIII\Models\CurrencyExchangeRate
|
||||||
*
|
*
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property \Illuminate\Support\Carbon|null $created_at
|
* @property Carbon|null $created_at
|
||||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
* @property Carbon|null $updated_at
|
||||||
* @property string|null $deleted_at
|
* @property string|null $deleted_at
|
||||||
* @property int $user_id
|
* @property int $user_id
|
||||||
* @property int $from_currency_id
|
* @property int $from_currency_id
|
||||||
* @property int $to_currency_id
|
* @property int $to_currency_id
|
||||||
* @property \Illuminate\Support\Carbon $date
|
* @property Carbon $date
|
||||||
* @property string $rate
|
* @property string $rate
|
||||||
* @property string|null $user_rate
|
* @property string|null $user_rate
|
||||||
* @property-read TransactionCurrency $fromCurrency
|
* @property-read TransactionCurrency $fromCurrency
|
||||||
|
@ -22,21 +22,22 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Models;
|
namespace FireflyIII\Models;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
|
||||||
use Eloquent;
|
use Eloquent;
|
||||||
use Illuminate\Database\Eloquent\Collection;
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Illuminate\Database\Query\Builder;
|
use Illuminate\Database\Query\Builder;
|
||||||
|
use Illuminate\Support\Carbon;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\LinkType
|
* FireflyIII\Models\LinkType
|
||||||
*
|
*
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property \Illuminate\Support\Carbon|null $created_at
|
* @property Carbon|null $created_at
|
||||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
* @property Carbon|null $updated_at
|
||||||
* @property \Illuminate\Support\Carbon|null $deleted_at
|
* @property Carbon|null $deleted_at
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property string $outward
|
* @property string $outward
|
||||||
* @property string $inward
|
* @property string $inward
|
||||||
@ -63,6 +64,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
class LinkType extends Model
|
class LinkType extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that should be casted to native types.
|
* The attributes that should be casted to native types.
|
||||||
*
|
*
|
||||||
@ -84,14 +86,14 @@ class LinkType extends Model
|
|||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value
|
||||||
*
|
*
|
||||||
* @throws NotFoundHttpException
|
|
||||||
* @return LinkType
|
* @return LinkType
|
||||||
*
|
*
|
||||||
|
* @throws NotFoundHttpException
|
||||||
*/
|
*/
|
||||||
public static function routeBinder(string $value): LinkType
|
public static function routeBinder(string $value): LinkType
|
||||||
{
|
{
|
||||||
if (auth()->check()) {
|
if (auth()->check()) {
|
||||||
$linkTypeId = (int) $value;
|
$linkTypeId = (int)$value;
|
||||||
$linkType = self::find($linkTypeId);
|
$linkType = self::find($linkTypeId);
|
||||||
if (null !== $linkType) {
|
if (null !== $linkType) {
|
||||||
return $linkType;
|
return $linkType;
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace FireflyIII\Models;
|
namespace FireflyIII\Models;
|
||||||
|
|
||||||
use Eloquent;
|
use Eloquent;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Collection;
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
@ -30,6 +31,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\Location
|
* FireflyIII\Models\Location
|
||||||
*
|
*
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace FireflyIII\Models;
|
namespace FireflyIII\Models;
|
||||||
|
|
||||||
use Eloquent;
|
use Eloquent;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
@ -32,6 +33,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|||||||
use Illuminate\Database\Eloquent\Relations\MorphToMany;
|
use Illuminate\Database\Eloquent\Relations\MorphToMany;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\ObjectGroup
|
* FireflyIII\Models\ObjectGroup
|
||||||
*
|
*
|
||||||
@ -63,8 +65,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
*/
|
*/
|
||||||
class ObjectGroup extends Model
|
class ObjectGroup extends Model
|
||||||
{
|
{
|
||||||
protected $fillable = ['title', 'order', 'user_id'];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that should be casted to native types.
|
* The attributes that should be casted to native types.
|
||||||
*
|
*
|
||||||
@ -77,13 +77,36 @@ class ObjectGroup extends Model
|
|||||||
'user_id' => 'integer',
|
'user_id' => 'integer',
|
||||||
'deleted_at' => 'datetime',
|
'deleted_at' => 'datetime',
|
||||||
];
|
];
|
||||||
|
protected $fillable = ['title', 'order', 'user_id'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Route binder. Converts the key in the URL to the specified object (or throw 404).
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
*
|
||||||
|
* @return ObjectGroup
|
||||||
|
* @throws NotFoundHttpException
|
||||||
|
*/
|
||||||
|
public static function routeBinder(string $value): ObjectGroup
|
||||||
|
{
|
||||||
|
if (auth()->check()) {
|
||||||
|
$objectGroupId = (int)$value;
|
||||||
|
/** @var ObjectGroup $objectGroup */
|
||||||
|
$objectGroup = self::where('object_groups.id', $objectGroupId)
|
||||||
|
->where('object_groups.user_id', auth()->user()->id)->first();
|
||||||
|
if (null !== $objectGroup) {
|
||||||
|
return $objectGroup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new NotFoundHttpException;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return MorphToMany
|
* @return MorphToMany
|
||||||
*/
|
*/
|
||||||
public function piggyBanks()
|
public function accounts()
|
||||||
{
|
{
|
||||||
return $this->morphedByMany(PiggyBank::class, 'object_groupable');
|
return $this->morphedByMany(Account::class, 'object_groupable');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -97,31 +120,9 @@ class ObjectGroup extends Model
|
|||||||
/**
|
/**
|
||||||
* @return MorphToMany
|
* @return MorphToMany
|
||||||
*/
|
*/
|
||||||
public function accounts()
|
public function piggyBanks()
|
||||||
{
|
{
|
||||||
return $this->morphedByMany(Account::class, 'object_groupable');
|
return $this->morphedByMany(PiggyBank::class, 'object_groupable');
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Route binder. Converts the key in the URL to the specified object (or throw 404).
|
|
||||||
*
|
|
||||||
* @param string $value
|
|
||||||
*
|
|
||||||
* @throws NotFoundHttpException
|
|
||||||
* @return ObjectGroup
|
|
||||||
*/
|
|
||||||
public static function routeBinder(string $value): ObjectGroup
|
|
||||||
{
|
|
||||||
if (auth()->check()) {
|
|
||||||
$objectGroupId = (int) $value;
|
|
||||||
/** @var ObjectGroup $objectGroup */
|
|
||||||
$objectGroup = self::where('object_groups.id', $objectGroupId)
|
|
||||||
->where('object_groups.user_id', auth()->user()->id)->first();
|
|
||||||
if (null !== $objectGroup) {
|
|
||||||
return $objectGroup;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw new NotFoundHttpException;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,7 +22,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Models;
|
namespace FireflyIII\Models;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
|
||||||
use Eloquent;
|
use Eloquent;
|
||||||
use Illuminate\Database\Eloquent\Collection;
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
@ -31,19 +30,21 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
|||||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Illuminate\Database\Query\Builder;
|
use Illuminate\Database\Query\Builder;
|
||||||
|
use Illuminate\Support\Carbon;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\PiggyBank
|
* FireflyIII\Models\PiggyBank
|
||||||
*
|
*
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property \Illuminate\Support\Carbon|null $created_at
|
* @property Carbon|null $created_at
|
||||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
* @property Carbon|null $updated_at
|
||||||
* @property \Illuminate\Support\Carbon|null $deleted_at
|
* @property Carbon|null $deleted_at
|
||||||
* @property int $account_id
|
* @property int $account_id
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property string $targetamount
|
* @property string $targetamount
|
||||||
* @property \Illuminate\Support\Carbon|null $startdate
|
* @property Carbon|null $startdate
|
||||||
* @property \Illuminate\Support\Carbon|null $targetdate
|
* @property Carbon|null $targetdate
|
||||||
* @property int $order
|
* @property int $order
|
||||||
* @property bool $active
|
* @property bool $active
|
||||||
* @property bool $encrypted
|
* @property bool $encrypted
|
||||||
@ -108,13 +109,13 @@ class PiggyBank extends Model
|
|||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value
|
||||||
*
|
*
|
||||||
* @throws NotFoundHttpException
|
|
||||||
* @return PiggyBank
|
* @return PiggyBank
|
||||||
|
* @throws NotFoundHttpException
|
||||||
*/
|
*/
|
||||||
public static function routeBinder(string $value): PiggyBank
|
public static function routeBinder(string $value): PiggyBank
|
||||||
{
|
{
|
||||||
if (auth()->check()) {
|
if (auth()->check()) {
|
||||||
$piggyBankId = (int) $value;
|
$piggyBankId = (int)$value;
|
||||||
$piggyBank = self::where('piggy_banks.id', $piggyBankId)
|
$piggyBank = self::where('piggy_banks.id', $piggyBankId)
|
||||||
->leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id')
|
->leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id')
|
||||||
->where('accounts.user_id', auth()->user()->id)->first(['piggy_banks.*']);
|
->where('accounts.user_id', auth()->user()->id)->first(['piggy_banks.*']);
|
||||||
@ -125,23 +126,6 @@ class PiggyBank extends Model
|
|||||||
throw new NotFoundHttpException;
|
throw new NotFoundHttpException;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get all of the tags for the post.
|
|
||||||
*/
|
|
||||||
public function objectGroups()
|
|
||||||
{
|
|
||||||
return $this->morphToMany(ObjectGroup::class, 'object_groupable');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @codeCoverageIgnore
|
|
||||||
* @return MorphMany
|
|
||||||
*/
|
|
||||||
public function attachments(): MorphMany
|
|
||||||
{
|
|
||||||
return $this->morphMany(Attachment::class, 'attachable');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
* @return BelongsTo
|
* @return BelongsTo
|
||||||
@ -151,6 +135,15 @@ class PiggyBank extends Model
|
|||||||
return $this->belongsTo(Account::class);
|
return $this->belongsTo(Account::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @codeCoverageIgnore
|
||||||
|
* @return MorphMany
|
||||||
|
*/
|
||||||
|
public function attachments(): MorphMany
|
||||||
|
{
|
||||||
|
return $this->morphMany(Attachment::class, 'attachable');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
* Get all of the piggy bank's notes.
|
* Get all of the piggy bank's notes.
|
||||||
@ -160,6 +153,14 @@ class PiggyBank extends Model
|
|||||||
return $this->morphMany(Note::class, 'noteable');
|
return $this->morphMany(Note::class, 'noteable');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all of the tags for the post.
|
||||||
|
*/
|
||||||
|
public function objectGroups()
|
||||||
|
{
|
||||||
|
return $this->morphToMany(ObjectGroup::class, 'object_groupable');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
* @return HasMany
|
* @return HasMany
|
||||||
@ -185,6 +186,6 @@ class PiggyBank extends Model
|
|||||||
*/
|
*/
|
||||||
public function setTargetamountAttribute($value): void
|
public function setTargetamountAttribute($value): void
|
||||||
{
|
{
|
||||||
$this->attributes['targetamount'] = (string) $value;
|
$this->attributes['targetamount'] = (string)$value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,20 +22,21 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Models;
|
namespace FireflyIII\Models;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
|
||||||
use Eloquent;
|
use Eloquent;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
use Illuminate\Support\Carbon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\PiggyBankEvent
|
* FireflyIII\Models\PiggyBankEvent
|
||||||
*
|
*
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property \Illuminate\Support\Carbon|null $created_at
|
* @property Carbon|null $created_at
|
||||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
* @property Carbon|null $updated_at
|
||||||
* @property int $piggy_bank_id
|
* @property int $piggy_bank_id
|
||||||
* @property int|null $transaction_journal_id
|
* @property int|null $transaction_journal_id
|
||||||
* @property \Illuminate\Support\Carbon $date
|
* @property Carbon $date
|
||||||
* @property string $amount
|
* @property string $amount
|
||||||
* @property PiggyBank $piggyBank
|
* @property PiggyBank $piggyBank
|
||||||
* @property-read TransactionJournal|null $transactionJournal
|
* @property-read TransactionJournal|null $transactionJournal
|
||||||
@ -85,7 +86,7 @@ class PiggyBankEvent extends Model
|
|||||||
*/
|
*/
|
||||||
public function setAmountAttribute($value): void
|
public function setAmountAttribute($value): void
|
||||||
{
|
{
|
||||||
$this->attributes['amount'] = (string) $value;
|
$this->attributes['amount'] = (string)$value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,14 +31,14 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|||||||
/**
|
/**
|
||||||
* FireflyIII\Models\PiggyBankRepetition
|
* FireflyIII\Models\PiggyBankRepetition
|
||||||
*
|
*
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property \Illuminate\Support\Carbon|null $created_at
|
* @property \Illuminate\Support\Carbon|null $created_at
|
||||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||||
* @property int $piggy_bank_id
|
* @property int $piggy_bank_id
|
||||||
* @property \Illuminate\Support\Carbon|null $startdate
|
* @property \Illuminate\Support\Carbon|null $startdate
|
||||||
* @property \Illuminate\Support\Carbon|null $targetdate
|
* @property \Illuminate\Support\Carbon|null $targetdate
|
||||||
* @property string $currentamount
|
* @property string $currentamount
|
||||||
* @property-read PiggyBank $piggyBank
|
* @property-read PiggyBank $piggyBank
|
||||||
* @method static EloquentBuilder|PiggyBankRepetition newModelQuery()
|
* @method static EloquentBuilder|PiggyBankRepetition newModelQuery()
|
||||||
* @method static EloquentBuilder|PiggyBankRepetition newQuery()
|
* @method static EloquentBuilder|PiggyBankRepetition newQuery()
|
||||||
* @method static EloquentBuilder|PiggyBankRepetition onDates(Carbon $start, Carbon $target)
|
* @method static EloquentBuilder|PiggyBankRepetition onDates(Carbon $start, Carbon $target)
|
||||||
@ -124,6 +124,6 @@ class PiggyBankRepetition extends Model
|
|||||||
*/
|
*/
|
||||||
public function setCurrentamountAttribute($value): void
|
public function setCurrentamountAttribute($value): void
|
||||||
{
|
{
|
||||||
$this->attributes['currentamount'] = (string) $value;
|
$this->attributes['currentamount'] = (string)$value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,13 +33,13 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
/**
|
/**
|
||||||
* FireflyIII\Models\Preference
|
* FireflyIII\Models\Preference
|
||||||
*
|
*
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property Carbon|null $created_at
|
* @property Carbon|null $created_at
|
||||||
* @property Carbon|null $updated_at
|
* @property Carbon|null $updated_at
|
||||||
* @property int $user_id
|
* @property int $user_id
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property int|string|array|null $data
|
* @property int|string|array|null $data
|
||||||
* @property-read User $user
|
* @property-read User $user
|
||||||
* @method static Builder|Preference newModelQuery()
|
* @method static Builder|Preference newModelQuery()
|
||||||
* @method static Builder|Preference newQuery()
|
* @method static Builder|Preference newQuery()
|
||||||
* @method static Builder|Preference query()
|
* @method static Builder|Preference query()
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace FireflyIII\Models;
|
namespace FireflyIII\Models;
|
||||||
|
|
||||||
use Eloquent;
|
use Eloquent;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Database\Eloquent\Collection;
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
@ -37,10 +38,10 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
/**
|
/**
|
||||||
* FireflyIII\Models\Recurrence
|
* FireflyIII\Models\Recurrence
|
||||||
*
|
*
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property Carbon|null $created_at
|
* @property Carbon|null $created_at
|
||||||
* @property Carbon|null $updated_at
|
* @property Carbon|null $updated_at
|
||||||
* @property Carbon|null $deleted_at
|
* @property Carbon|null $deleted_at
|
||||||
* @property int $user_id
|
* @property int $user_id
|
||||||
* @property int $transaction_type_id
|
* @property int $transaction_type_id
|
||||||
* @property string $title
|
* @property string $title
|
||||||
@ -89,6 +90,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
class Recurrence extends Model
|
class Recurrence extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that should be casted to native types.
|
* The attributes that should be casted to native types.
|
||||||
*
|
*
|
||||||
@ -120,13 +122,13 @@ class Recurrence extends Model
|
|||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value
|
||||||
*
|
*
|
||||||
* @throws NotFoundHttpException
|
|
||||||
* @return Recurrence
|
* @return Recurrence
|
||||||
|
* @throws NotFoundHttpException
|
||||||
*/
|
*/
|
||||||
public static function routeBinder(string $value): Recurrence
|
public static function routeBinder(string $value): Recurrence
|
||||||
{
|
{
|
||||||
if (auth()->check()) {
|
if (auth()->check()) {
|
||||||
$recurrenceId = (int) $value;
|
$recurrenceId = (int)$value;
|
||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
/** @var Recurrence $recurrence */
|
/** @var Recurrence $recurrence */
|
||||||
@ -138,6 +140,15 @@ class Recurrence extends Model
|
|||||||
throw new NotFoundHttpException;
|
throw new NotFoundHttpException;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @codeCoverageIgnore
|
||||||
|
* @return MorphMany
|
||||||
|
*/
|
||||||
|
public function attachments(): MorphMany
|
||||||
|
{
|
||||||
|
return $this->morphMany(Attachment::class, 'attachable');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
* Get all of the notes.
|
* Get all of the notes.
|
||||||
@ -183,15 +194,6 @@ class Recurrence extends Model
|
|||||||
return $this->belongsTo(TransactionCurrency::class);
|
return $this->belongsTo(TransactionCurrency::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @codeCoverageIgnore
|
|
||||||
* @return MorphMany
|
|
||||||
*/
|
|
||||||
public function attachments(): MorphMany
|
|
||||||
{
|
|
||||||
return $this->morphMany(Attachment::class, 'attachable');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
* @return BelongsTo
|
* @return BelongsTo
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace FireflyIII\Models;
|
namespace FireflyIII\Models;
|
||||||
|
|
||||||
use Eloquent;
|
use Eloquent;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
@ -58,6 +59,7 @@ use Illuminate\Support\Carbon;
|
|||||||
class RecurrenceMeta extends Model
|
class RecurrenceMeta extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that should be casted to native types.
|
* The attributes that should be casted to native types.
|
||||||
*
|
*
|
||||||
|
@ -22,20 +22,21 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace FireflyIII\Models;
|
namespace FireflyIII\Models;
|
||||||
use Carbon\Carbon;
|
|
||||||
use Eloquent;
|
use Eloquent;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Illuminate\Database\Query\Builder;
|
use Illuminate\Database\Query\Builder;
|
||||||
|
use Illuminate\Support\Carbon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\RecurrenceRepetition
|
* FireflyIII\Models\RecurrenceRepetition
|
||||||
*
|
*
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property \Illuminate\Support\Carbon|null $created_at
|
* @property Carbon|null $created_at
|
||||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
* @property Carbon|null $updated_at
|
||||||
* @property \Illuminate\Support\Carbon|null $deleted_at
|
* @property Carbon|null $deleted_at
|
||||||
* @property int $recurrence_id
|
* @property int $recurrence_id
|
||||||
* @property string $repetition_type
|
* @property string $repetition_type
|
||||||
* @property string $repetition_moment
|
* @property string $repetition_moment
|
||||||
@ -70,6 +71,7 @@ class RecurrenceRepetition extends Model
|
|||||||
/** @var int */
|
/** @var int */
|
||||||
public const WEEKEND_TO_MONDAY = 4;
|
public const WEEKEND_TO_MONDAY = 4;
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that should be casted to native types.
|
* The attributes that should be casted to native types.
|
||||||
*
|
*
|
||||||
|
@ -22,20 +22,21 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace FireflyIII\Models;
|
namespace FireflyIII\Models;
|
||||||
|
|
||||||
use Eloquent;
|
use Eloquent;
|
||||||
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Illuminate\Database\Query\Builder;
|
use Illuminate\Database\Query\Builder;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
use Illuminate\Support\Collection;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\RecurrenceTransaction
|
* FireflyIII\Models\RecurrenceTransaction
|
||||||
*
|
*
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property Carbon|null $created_at
|
* @property Carbon|null $created_at
|
||||||
* @property Carbon|null $updated_at
|
* @property Carbon|null $updated_at
|
||||||
* @property Carbon|null $deleted_at
|
* @property Carbon|null $deleted_at
|
||||||
* @property int $recurrence_id
|
* @property int $recurrence_id
|
||||||
@ -49,7 +50,7 @@ use Illuminate\Support\Collection;
|
|||||||
* @property-read Account $destinationAccount
|
* @property-read Account $destinationAccount
|
||||||
* @property-read TransactionCurrency|null $foreignCurrency
|
* @property-read TransactionCurrency|null $foreignCurrency
|
||||||
* @property-read Recurrence $recurrence
|
* @property-read Recurrence $recurrence
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|RecurrenceTransactionMeta[] $recurrenceTransactionMeta
|
* @property-read Collection|RecurrenceTransactionMeta[] $recurrenceTransactionMeta
|
||||||
* @property-read int|null $recurrence_transaction_meta_count
|
* @property-read int|null $recurrence_transaction_meta_count
|
||||||
* @property-read Account $sourceAccount
|
* @property-read Account $sourceAccount
|
||||||
* @property-read TransactionCurrency $transactionCurrency
|
* @property-read TransactionCurrency $transactionCurrency
|
||||||
@ -79,6 +80,7 @@ use Illuminate\Support\Collection;
|
|||||||
class RecurrenceTransaction extends Model
|
class RecurrenceTransaction extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that should be casted to native types.
|
* The attributes that should be casted to native types.
|
||||||
*
|
*
|
||||||
@ -153,6 +155,7 @@ class RecurrenceTransaction extends Model
|
|||||||
{
|
{
|
||||||
return $this->belongsTo(TransactionCurrency::class);
|
return $this->belongsTo(TransactionCurrency::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
* @return BelongsTo
|
* @return BelongsTo
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace FireflyIII\Models;
|
namespace FireflyIII\Models;
|
||||||
|
|
||||||
use Eloquent;
|
use Eloquent;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
@ -58,6 +59,7 @@ use Illuminate\Support\Carbon;
|
|||||||
class RecurrenceTransactionMeta extends Model
|
class RecurrenceTransactionMeta extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that should be casted to native types.
|
* The attributes that should be casted to native types.
|
||||||
*
|
*
|
||||||
|
@ -36,25 +36,25 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
/**
|
/**
|
||||||
* FireflyIII\Models\Rule
|
* FireflyIII\Models\Rule
|
||||||
*
|
*
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property Carbon|null $created_at
|
* @property Carbon|null $created_at
|
||||||
* @property Carbon|null $updated_at
|
* @property Carbon|null $updated_at
|
||||||
* @property Carbon|null $deleted_at
|
* @property Carbon|null $deleted_at
|
||||||
* @property int $user_id
|
* @property int $user_id
|
||||||
* @property int $rule_group_id
|
* @property int $rule_group_id
|
||||||
* @property string $title
|
* @property string $title
|
||||||
* @property string|null $description
|
* @property string|null $description
|
||||||
* @property int $order
|
* @property int $order
|
||||||
* @property bool $active
|
* @property bool $active
|
||||||
* @property bool $stop_processing
|
* @property bool $stop_processing
|
||||||
* @property bool $strict
|
* @property bool $strict
|
||||||
* @property-read string $action_value
|
* @property-read string $action_value
|
||||||
* @property-read Collection|RuleAction[] $ruleActions
|
* @property-read Collection|RuleAction[] $ruleActions
|
||||||
* @property-read int|null $rule_actions_count
|
* @property-read int|null $rule_actions_count
|
||||||
* @property-read RuleGroup $ruleGroup
|
* @property-read RuleGroup $ruleGroup
|
||||||
* @property Collection|RuleTrigger[] $ruleTriggers
|
* @property Collection|RuleTrigger[] $ruleTriggers
|
||||||
* @property-read int|null $rule_triggers_count
|
* @property-read int|null $rule_triggers_count
|
||||||
* @property-read User $user
|
* @property-read User $user
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Rule newModelQuery()
|
* @method static \Illuminate\Database\Eloquent\Builder|Rule newModelQuery()
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Rule newQuery()
|
* @method static \Illuminate\Database\Eloquent\Builder|Rule newQuery()
|
||||||
* @method static Builder|Rule onlyTrashed()
|
* @method static Builder|Rule onlyTrashed()
|
||||||
|
@ -22,18 +22,18 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Models;
|
namespace FireflyIII\Models;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
|
||||||
use Eloquent;
|
use Eloquent;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
use Illuminate\Support\Carbon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\RuleAction
|
* FireflyIII\Models\RuleAction
|
||||||
*
|
*
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property \Illuminate\Support\Carbon|null $created_at
|
* @property Carbon|null $created_at
|
||||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
* @property Carbon|null $updated_at
|
||||||
* @property int $rule_id
|
* @property int $rule_id
|
||||||
* @property string $action_type
|
* @property string $action_type
|
||||||
* @property string $action_value
|
* @property string $action_value
|
||||||
|
@ -22,30 +22,31 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Models;
|
namespace FireflyIII\Models;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
|
||||||
use Eloquent;
|
use Eloquent;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Illuminate\Database\Query\Builder;
|
use Illuminate\Database\Query\Builder;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Carbon;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\RuleGroup
|
* FireflyIII\Models\RuleGroup
|
||||||
*
|
*
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property \Illuminate\Support\Carbon|null $created_at
|
* @property Carbon|null $created_at
|
||||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
* @property Carbon|null $updated_at
|
||||||
* @property \Illuminate\Support\Carbon|null $deleted_at
|
* @property Carbon|null $deleted_at
|
||||||
* @property int $user_id
|
* @property int $user_id
|
||||||
* @property string $title
|
* @property string $title
|
||||||
* @property string|null $description
|
* @property string|null $description
|
||||||
* @property int $order
|
* @property int $order
|
||||||
* @property bool $active
|
* @property bool $active
|
||||||
* @property bool $stop_processing
|
* @property bool $stop_processing
|
||||||
* @property \Illuminate\Database\Eloquent\Collection|Rule[] $rules
|
* @property Collection|Rule[] $rules
|
||||||
* @property-read int|null $rules_count
|
* @property-read int|null $rules_count
|
||||||
* @property-read User $user
|
* @property-read User $user
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|RuleGroup newModelQuery()
|
* @method static \Illuminate\Database\Eloquent\Builder|RuleGroup newModelQuery()
|
||||||
@ -69,6 +70,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
class RuleGroup extends Model
|
class RuleGroup extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that should be casted to native types.
|
* The attributes that should be casted to native types.
|
||||||
*
|
*
|
||||||
@ -92,13 +94,13 @@ class RuleGroup extends Model
|
|||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value
|
||||||
*
|
*
|
||||||
* @throws NotFoundHttpException
|
|
||||||
* @return RuleGroup
|
* @return RuleGroup
|
||||||
|
* @throws NotFoundHttpException
|
||||||
*/
|
*/
|
||||||
public static function routeBinder(string $value): RuleGroup
|
public static function routeBinder(string $value): RuleGroup
|
||||||
{
|
{
|
||||||
if (auth()->check()) {
|
if (auth()->check()) {
|
||||||
$ruleGroupId = (int) $value;
|
$ruleGroupId = (int)$value;
|
||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
/** @var RuleGroup $ruleGroup */
|
/** @var RuleGroup $ruleGroup */
|
||||||
|
@ -22,18 +22,18 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Models;
|
namespace FireflyIII\Models;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
|
||||||
use Eloquent;
|
use Eloquent;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
use Illuminate\Support\Carbon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\RuleTrigger
|
* FireflyIII\Models\RuleTrigger
|
||||||
*
|
*
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property \Illuminate\Support\Carbon|null $created_at
|
* @property Carbon|null $created_at
|
||||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
* @property Carbon|null $updated_at
|
||||||
* @property int $rule_id
|
* @property int $rule_id
|
||||||
* @property string $trigger_type
|
* @property string $trigger_type
|
||||||
* @property string $trigger_value
|
* @property string $trigger_value
|
||||||
|
@ -35,33 +35,33 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||||||
/**
|
/**
|
||||||
* FireflyIII\Models\Transaction
|
* FireflyIII\Models\Transaction
|
||||||
*
|
*
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property \Illuminate\Support\Carbon|null $created_at
|
* @property \Illuminate\Support\Carbon|null $created_at
|
||||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||||
* @property \Illuminate\Support\Carbon|null $deleted_at
|
* @property \Illuminate\Support\Carbon|null $deleted_at
|
||||||
* @property bool $reconciled
|
* @property bool $reconciled
|
||||||
* @property int $account_id
|
* @property int $account_id
|
||||||
* @property int $transaction_journal_id
|
* @property int $transaction_journal_id
|
||||||
* @property string|null $description
|
* @property string|null $description
|
||||||
* @property int|null $transaction_currency_id
|
* @property int|null $transaction_currency_id
|
||||||
* @property string $modified
|
* @property string $modified
|
||||||
* @property string $modified_foreign
|
* @property string $modified_foreign
|
||||||
* @property string $date
|
* @property string $date
|
||||||
* @property string $max_date
|
* @property string $max_date
|
||||||
* @property string $amount
|
* @property string $amount
|
||||||
* @property string|null $foreign_amount
|
* @property string|null $foreign_amount
|
||||||
* @property int|null $foreign_currency_id
|
* @property int|null $foreign_currency_id
|
||||||
* @property int $identifier
|
* @property int $identifier
|
||||||
* @property-read \FireflyIII\Models\Account $account
|
* @property-read Account $account
|
||||||
* @property-read Collection|\FireflyIII\Models\Budget[] $budgets
|
* @property-read Collection|Budget[] $budgets
|
||||||
* @property-read int|null $budgets_count
|
* @property-read int|null $budgets_count
|
||||||
* @property-read Collection|\FireflyIII\Models\Category[] $categories
|
* @property-read Collection|Category[] $categories
|
||||||
* @property-read int|null $categories_count
|
* @property-read int|null $categories_count
|
||||||
* @property-read \FireflyIII\Models\TransactionCurrency|null $foreignCurrency
|
* @property-read TransactionCurrency|null $foreignCurrency
|
||||||
* @property-read \FireflyIII\Models\TransactionCurrency|null $transactionCurrency
|
* @property-read TransactionCurrency|null $transactionCurrency
|
||||||
* @property-read \FireflyIII\Models\TransactionJournal $transactionJournal
|
* @property-read TransactionJournal $transactionJournal
|
||||||
* @method static Builder|Transaction after(\Carbon\Carbon $date)
|
* @method static Builder|Transaction after(Carbon $date)
|
||||||
* @method static Builder|Transaction before(\Carbon\Carbon $date)
|
* @method static Builder|Transaction before(Carbon $date)
|
||||||
* @method static Builder|Transaction newModelQuery()
|
* @method static Builder|Transaction newModelQuery()
|
||||||
* @method static Builder|Transaction newQuery()
|
* @method static Builder|Transaction newQuery()
|
||||||
* @method static \Illuminate\Database\Query\Builder|Transaction onlyTrashed()
|
* @method static \Illuminate\Database\Query\Builder|Transaction onlyTrashed()
|
||||||
@ -83,11 +83,12 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||||||
* @method static \Illuminate\Database\Query\Builder|Transaction withTrashed()
|
* @method static \Illuminate\Database\Query\Builder|Transaction withTrashed()
|
||||||
* @method static \Illuminate\Database\Query\Builder|Transaction withoutTrashed()
|
* @method static \Illuminate\Database\Query\Builder|Transaction withoutTrashed()
|
||||||
* @mixin Eloquent
|
* @mixin Eloquent
|
||||||
* @property int $the_count
|
* @property int $the_count
|
||||||
*/
|
*/
|
||||||
class Transaction extends Model
|
class Transaction extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes, HasFactory;
|
use SoftDeletes, HasFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that should be casted to native types.
|
* The attributes that should be casted to native types.
|
||||||
*
|
*
|
||||||
@ -110,30 +111,6 @@ class Transaction extends Model
|
|||||||
/** @var array Hidden from view */
|
/** @var array Hidden from view */
|
||||||
protected $hidden = ['encrypted'];
|
protected $hidden = ['encrypted'];
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if a table is joined.
|
|
||||||
*
|
|
||||||
* @param Builder $query
|
|
||||||
* @param string $table
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
* @codeCoverageIgnore
|
|
||||||
*/
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the account this object belongs to.
|
* Get the account this object belongs to.
|
||||||
*
|
*
|
||||||
@ -194,6 +171,30 @@ class Transaction extends Model
|
|||||||
$query->where('transaction_journals.date', '>=', $date->format('Y-m-d 00:00:00'));
|
$query->where('transaction_journals.date', '>=', $date->format('Y-m-d 00:00:00'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a table is joined.
|
||||||
|
*
|
||||||
|
* @param Builder $query
|
||||||
|
* @param string $table
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @codeCoverageIgnore
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check for transactions BEFORE the specified date.
|
* Check for transactions BEFORE the specified date.
|
||||||
*
|
*
|
||||||
@ -235,7 +236,7 @@ class Transaction extends Model
|
|||||||
*/
|
*/
|
||||||
public function setAmountAttribute($value): void
|
public function setAmountAttribute($value): void
|
||||||
{
|
{
|
||||||
$this->attributes['amount'] = (string) $value;
|
$this->attributes['amount'] = (string)$value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,21 +22,22 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Models;
|
namespace FireflyIII\Models;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
|
||||||
use Eloquent;
|
use Eloquent;
|
||||||
use Illuminate\Database\Eloquent\Collection;
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Illuminate\Database\Query\Builder;
|
use Illuminate\Database\Query\Builder;
|
||||||
|
use Illuminate\Support\Carbon;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\TransactionCurrency
|
* FireflyIII\Models\TransactionCurrency
|
||||||
*
|
*
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property \Illuminate\Support\Carbon|null $created_at
|
* @property Carbon|null $created_at
|
||||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
* @property Carbon|null $updated_at
|
||||||
* @property \Illuminate\Support\Carbon|null $deleted_at
|
* @property Carbon|null $deleted_at
|
||||||
* @property bool $enabled
|
* @property bool $enabled
|
||||||
* @property string $code
|
* @property string $code
|
||||||
* @property string $name
|
* @property string $name
|
||||||
@ -90,13 +91,13 @@ class TransactionCurrency extends Model
|
|||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value
|
||||||
*
|
*
|
||||||
* @throws NotFoundHttpException
|
|
||||||
* @return TransactionCurrency
|
* @return TransactionCurrency
|
||||||
|
* @throws NotFoundHttpException
|
||||||
*/
|
*/
|
||||||
public static function routeBinder(string $value): TransactionCurrency
|
public static function routeBinder(string $value): TransactionCurrency
|
||||||
{
|
{
|
||||||
if (auth()->check()) {
|
if (auth()->check()) {
|
||||||
$currencyId = (int) $value;
|
$currencyId = (int)$value;
|
||||||
$currency = self::find($currencyId);
|
$currency = self::find($currencyId);
|
||||||
if (null !== $currency) {
|
if (null !== $currency) {
|
||||||
return $currency;
|
return $currency;
|
||||||
|
@ -32,6 +32,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||||||
use Illuminate\Database\Query\Builder;
|
use Illuminate\Database\Query\Builder;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\TransactionGroup
|
* FireflyIII\Models\TransactionGroup
|
||||||
*
|
*
|
||||||
@ -85,13 +86,13 @@ class TransactionGroup extends Model
|
|||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value
|
||||||
*
|
*
|
||||||
* @throws NotFoundHttpException
|
|
||||||
* @return TransactionGroup
|
* @return TransactionGroup
|
||||||
|
* @throws NotFoundHttpException
|
||||||
*/
|
*/
|
||||||
public static function routeBinder(string $value): TransactionGroup
|
public static function routeBinder(string $value): TransactionGroup
|
||||||
{
|
{
|
||||||
if (auth()->check()) {
|
if (auth()->check()) {
|
||||||
$groupId = (int) $value;
|
$groupId = (int)$value;
|
||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
/** @var TransactionGroup $group */
|
/** @var TransactionGroup $group */
|
||||||
|
@ -22,21 +22,21 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Models;
|
namespace FireflyIII\Models;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
|
||||||
use Eloquent;
|
use Eloquent;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Collection;
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||||
|
use Illuminate\Support\Carbon;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\TransactionJournalLink
|
* FireflyIII\Models\TransactionJournalLink
|
||||||
*
|
*
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property \Illuminate\Support\Carbon|null $created_at
|
* @property Carbon|null $created_at
|
||||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
* @property Carbon|null $updated_at
|
||||||
* @property int $link_type_id
|
* @property int $link_type_id
|
||||||
* @property int $source_id
|
* @property int $source_id
|
||||||
* @property int $destination_id
|
* @property int $destination_id
|
||||||
@ -80,14 +80,14 @@ class TransactionJournalLink extends Model
|
|||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value
|
||||||
*
|
*
|
||||||
* @throws NotFoundHttpException
|
|
||||||
* @return TransactionJournalLink
|
* @return TransactionJournalLink
|
||||||
*
|
*
|
||||||
|
* @throws NotFoundHttpException
|
||||||
*/
|
*/
|
||||||
public static function routeBinder(string $value): TransactionJournalLink
|
public static function routeBinder(string $value): TransactionJournalLink
|
||||||
{
|
{
|
||||||
if (auth()->check()) {
|
if (auth()->check()) {
|
||||||
$linkId = (int) $value;
|
$linkId = (int)$value;
|
||||||
$link = self::where('journal_links.id', $linkId)
|
$link = self::where('journal_links.id', $linkId)
|
||||||
->leftJoin('transaction_journals as t_a', 't_a.id', '=', 'source_id')
|
->leftJoin('transaction_journals as t_a', 't_a.id', '=', 'source_id')
|
||||||
->leftJoin('transaction_journals as t_b', 't_b.id', '=', 'destination_id')
|
->leftJoin('transaction_journals as t_b', 't_b.id', '=', 'destination_id')
|
||||||
|
@ -60,6 +60,7 @@ use Illuminate\Support\Carbon;
|
|||||||
class TransactionJournalMeta extends Model
|
class TransactionJournalMeta extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that should be casted to native types.
|
* The attributes that should be casted to native types.
|
||||||
*
|
*
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace FireflyIII\Models;
|
namespace FireflyIII\Models;
|
||||||
|
|
||||||
use Eloquent;
|
use Eloquent;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
@ -36,7 +37,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
/**
|
/**
|
||||||
* FireflyIII\Models\Webhook
|
* FireflyIII\Models\Webhook
|
||||||
*
|
*
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property Carbon|null $created_at
|
* @property Carbon|null $created_at
|
||||||
* @property Carbon|null $updated_at
|
* @property Carbon|null $updated_at
|
||||||
* @property Carbon|null $deleted_at
|
* @property Carbon|null $deleted_at
|
||||||
@ -66,8 +67,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
* @method static \Illuminate\Database\Query\Builder|Webhook withTrashed()
|
* @method static \Illuminate\Database\Query\Builder|Webhook withTrashed()
|
||||||
* @method static \Illuminate\Database\Query\Builder|Webhook withoutTrashed()
|
* @method static \Illuminate\Database\Query\Builder|Webhook withoutTrashed()
|
||||||
* @mixin Eloquent
|
* @mixin Eloquent
|
||||||
* @property string $title
|
* @property string $title
|
||||||
* @property string $secret
|
* @property string $secret
|
||||||
* @method static Builder|Webhook whereSecret($value)
|
* @method static Builder|Webhook whereSecret($value)
|
||||||
* @method static Builder|Webhook whereTitle($value)
|
* @method static Builder|Webhook whereTitle($value)
|
||||||
*/
|
*/
|
||||||
@ -88,9 +89,6 @@ class Webhook extends Model
|
|||||||
|
|
||||||
// delivery
|
// delivery
|
||||||
public const DELIVERY_JSON = 300;
|
public const DELIVERY_JSON = 300;
|
||||||
|
|
||||||
protected $fillable = ['active', 'trigger', 'response', 'delivery', 'user_id', 'url', 'title', 'secret'];
|
|
||||||
|
|
||||||
protected $casts
|
protected $casts
|
||||||
= [
|
= [
|
||||||
'active' => 'boolean',
|
'active' => 'boolean',
|
||||||
@ -98,6 +96,7 @@ class Webhook extends Model
|
|||||||
'response' => 'integer',
|
'response' => 'integer',
|
||||||
'delivery' => 'integer',
|
'delivery' => 'integer',
|
||||||
];
|
];
|
||||||
|
protected $fillable = ['active', 'trigger', 'response', 'delivery', 'user_id', 'url', 'title', 'secret'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Route binder. Converts the key in the URL to the specified object (or throw 404).
|
* Route binder. Converts the key in the URL to the specified object (or throw 404).
|
||||||
|
@ -64,15 +64,6 @@ class WebhookAttempt extends Model
|
|||||||
{
|
{
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
|
||||||
/**
|
|
||||||
* @codeCoverageIgnore
|
|
||||||
* @return BelongsTo
|
|
||||||
*/
|
|
||||||
public function webhookMessage(): BelongsTo
|
|
||||||
{
|
|
||||||
return $this->belongsTo(WebhookMessage::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Route binder. Converts the key in the URL to the specified object (or throw 404).
|
* Route binder. Converts the key in the URL to the specified object (or throw 404).
|
||||||
*
|
*
|
||||||
@ -95,4 +86,13 @@ class WebhookAttempt extends Model
|
|||||||
}
|
}
|
||||||
throw new NotFoundHttpException;
|
throw new NotFoundHttpException;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @codeCoverageIgnore
|
||||||
|
* @return BelongsTo
|
||||||
|
*/
|
||||||
|
public function webhookMessage(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(WebhookMessage::class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
/**
|
/**
|
||||||
* FireflyIII\Models\WebhookMessage
|
* FireflyIII\Models\WebhookMessage
|
||||||
*
|
*
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property Carbon|null $created_at
|
* @property Carbon|null $created_at
|
||||||
* @property Carbon|null $updated_at
|
* @property Carbon|null $updated_at
|
||||||
* @property string|null $deleted_at
|
* @property string|null $deleted_at
|
||||||
|
Loading…
Reference in New Issue
Block a user