feat(attachments): add HasAttachments trait to manage attachment relationships

This commit is contained in:
2026-06-25 14:47:21 -03:00
parent 56b87f0c12
commit 6db98ddc1a
2 changed files with 23 additions and 3 deletions

View File

@@ -0,0 +1,18 @@
<?php
namespace App\Domains\Attachable\Models\Concerns;
use App\Domains\Attachable\Models\Attachment;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\MorphMany;
trait HasAttachments
{
/**
* @return MorphMany<Attachment, Model>
*/
public function attachments(): MorphMany
{
return $this->morphMany(Attachment::class, 'attachable');
}
}