Files
expense/app/Traits/HasAttachments.php
T

15 lines
350 B
PHP
Raw Normal View History

2026-06-01 15:01:03 +07:00
<?php
namespace App\Traits;
use App\Models\AttachmentForm;
trait HasAttachments
{
public function attachments()
{
// Relasi ini akan otomatis menyesuaikan table_name berdasarkan property $table di model
return $this->hasMany(AttachmentForm::class, 'form_id')
->where('table_name', $this->table);
}
}