enhanced services attachment
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class AttachmentForm extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'attachment_form';
|
||||
|
||||
protected $fillable = [
|
||||
'form_id',
|
||||
'table_name',
|
||||
'file_category',
|
||||
'file_path',
|
||||
];
|
||||
|
||||
/**
|
||||
* Relasi dinamis ke table form terkait
|
||||
*/
|
||||
public function form()
|
||||
{
|
||||
return $this->morphTo(__FUNCTION__, 'table_name', 'form_id');
|
||||
}
|
||||
}
|
||||
@@ -37,4 +37,11 @@ class FormEntertaimentPresentation extends Model
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -40,4 +40,10 @@ class FormMeetingSeminar extends Model
|
||||
{
|
||||
return $this->belongsTo(Admin::class, 'user_id');
|
||||
}
|
||||
|
||||
public function attachments()
|
||||
{
|
||||
return $this->hasMany(\App\Models\AttachmentForm::class, 'form_id')
|
||||
->where('table_name', \App\Enums\AttachmentTableName::FORM_MEETING_SEMINAR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,4 +39,10 @@ class FormOthers extends Model
|
||||
{
|
||||
return $this->belongsTo(Kategori::class);
|
||||
}
|
||||
|
||||
public function attachments()
|
||||
{
|
||||
return $this->hasMany(\App\Models\AttachmentForm::class, 'form_id')
|
||||
->where('table_name', \App\Enums\AttachmentTableName::FORM_OTHERS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,4 +52,10 @@ class FormUpCountry extends Model
|
||||
{
|
||||
return $this->belongsTo('App\Models\Rayon');
|
||||
}
|
||||
|
||||
public function attachments()
|
||||
{
|
||||
return $this->hasMany(\App\Models\AttachmentForm::class, 'form_id')
|
||||
->where('table_name', \App\Enums\AttachmentTableName::FORM_UP_COUNTRY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,4 +38,10 @@ class FormVehicleRunningCost extends Model
|
||||
{
|
||||
return $this->belongsTo('App\Models\Admin', 'user_id');
|
||||
}
|
||||
|
||||
public function attachments()
|
||||
{
|
||||
return $this->hasMany(\App\Models\AttachmentForm::class, 'form_id')
|
||||
->where('table_name', \App\Enums\AttachmentTableName::FORM_VEHICLE_RUNNING_COST);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user