This commit is contained in:
@@ -7,7 +7,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class FormEntertaimentPresentation extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
use SoftDeletes, \App\Traits\HasAttachments;
|
||||
|
||||
protected $table = 'form_entertainment_presentation';
|
||||
protected $fillable = [
|
||||
@@ -31,17 +31,40 @@ class FormEntertaimentPresentation extends Model
|
||||
'approved2_by',
|
||||
'final_approved_at',
|
||||
'final_approved_by',
|
||||
// Kolom baru
|
||||
'jabatan',
|
||||
'nama_perusahaan',
|
||||
'jenis_usaha',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'created_at' => 'datetime',
|
||||
'approved_at' => 'datetime',
|
||||
'approved2_at' => 'datetime',
|
||||
'final_approved_at' => 'datetime',
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Admin');
|
||||
}
|
||||
|
||||
public function attachments()
|
||||
{
|
||||
return $this->hasMany(\App\Models\AttachmentForm::class, 'form_id')
|
||||
->where('table_name', \App\Enums\AttachmentTableName::FORM_ENTERTAINMENT_PRESENTATION);
|
||||
}
|
||||
// Relasi ke kategori untuk mengambil account_number
|
||||
public function kategori()
|
||||
{
|
||||
return $this->belongsTo(Kategori::class, 'kategori_id');
|
||||
}
|
||||
|
||||
public function rejector() {
|
||||
return $this->belongsTo(User::class, 'rejected_by');
|
||||
}
|
||||
|
||||
// public function attachments()
|
||||
// {
|
||||
// // form_id adalah kolom di tabel attachment_forms
|
||||
// // table_name digunakan jika satu tabel attachment dipakai banyak form
|
||||
// return $this->hasMany(\App\Models\AttachmentForm::class, 'form_id')
|
||||
// ->where('table_name', 'form_entertainment_presentation');
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user