mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-05 04:03:26 +00:00
API can deal with attachments for more models. #2828
This commit is contained in:
@@ -134,6 +134,16 @@ class Account extends Model
|
||||
throw new NotFoundHttpException;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return MorphMany
|
||||
*/
|
||||
public function attachments(): MorphMany
|
||||
{
|
||||
return $this->morphMany(Attachment::class, 'attachable');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasMany
|
||||
* @codeCoverageIgnore
|
||||
|
@@ -58,8 +58,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @SuppressWarnings (PHPMD.CouplingBetweenObjects)
|
||||
* @property \Illuminate\Support\Carbon|null $deleted_at
|
||||
* @property int $user_id
|
||||
* @property bool $name_encrypted
|
||||
* @property bool $match_encrypted
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|Attachment[] $attachments
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|TransactionJournal[] $transactionJournals
|
||||
* @method static bool|null forceDelete()
|
||||
|
@@ -29,6 +29,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Query\Builder;
|
||||
use Illuminate\Support\Collection;
|
||||
@@ -133,6 +134,16 @@ class Budget extends Model
|
||||
return $this->hasMany(BudgetLimit::class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return MorphMany
|
||||
*/
|
||||
public function attachments(): MorphMany
|
||||
{
|
||||
return $this->morphMany(Attachment::class, 'attachable');
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return BelongsToMany
|
||||
|
@@ -30,6 +30,7 @@ use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Query\Builder;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
@@ -47,7 +48,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @property Carbon $updated_at
|
||||
* @property \Illuminate\Support\Carbon|null $deleted_at
|
||||
* @property int $user_id
|
||||
* @property bool $encrypted
|
||||
* @property-read Collection|TransactionJournal[] $transactionJournals
|
||||
* @property-read Collection|Transaction[] $transactions
|
||||
* @method static bool|null forceDelete()
|
||||
@@ -120,6 +120,16 @@ class Category extends Model
|
||||
return $this->belongsToMany(TransactionJournal::class, 'category_transaction_journal', 'category_id');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return MorphMany
|
||||
*/
|
||||
public function attachments(): MorphMany
|
||||
{
|
||||
return $this->morphMany(Attachment::class, 'attachable');
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return BelongsToMany
|
||||
|
@@ -49,7 +49,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @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
|
||||
@@ -122,6 +121,15 @@ class PiggyBank extends Model
|
||||
throw new NotFoundHttpException;
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return MorphMany
|
||||
*/
|
||||
public function attachments(): MorphMany
|
||||
{
|
||||
return $this->morphMany(Attachment::class, 'attachable');
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return BelongsTo
|
||||
|
@@ -130,6 +130,15 @@ class Tag extends Model
|
||||
return $this->morphMany(Location::class, 'locatable');
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return MorphMany
|
||||
*/
|
||||
public function attachments(): MorphMany
|
||||
{
|
||||
return $this->morphMany(Attachment::class, 'attachable');
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return BelongsToMany
|
||||
|
Reference in New Issue
Block a user