This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user