Files
expense/app/Traits/HasAttachments.php
T
root 1c1418f3e0
Deploy to VPS (PAT over HTTPS) / deploy (push) Has been cancelled
Initial commit - expense
2026-06-01 15:01:03 +07:00

15 lines
350 B
PHP

<?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);
}
}