mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/unity.git
synced 2026-08-23 14:24:08 +00:00
contract template obligation dependency api
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Http\Helpers\Hasher;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class ContractTemplateObligationDependency extends Model
|
||||
{
|
||||
protected $table = 'contract_template_obligation_dependencies';
|
||||
|
||||
protected $appends = [
|
||||
'hash_id',
|
||||
'contract_template_obligation_hash_id',
|
||||
'depend_contract_template_obligation_hash_id',
|
||||
'contract_template_obligation_list',
|
||||
'depend_contract_template_obligation_list'
|
||||
];
|
||||
|
||||
public function contract_template_obligation()
|
||||
{
|
||||
return $this->belongsTo('App\Models\ContractTemplateObligation', 'contract_template_obligation_id');
|
||||
}
|
||||
|
||||
public function depend_contract_template_obligation()
|
||||
{
|
||||
return $this->belongsTo('App\Models\ContractTemplateObligation', 'depend_contract_template_obligation_id');
|
||||
}
|
||||
|
||||
public function getHashIdAttribute()
|
||||
{
|
||||
return Hasher::encode('contract_template_obligation_dependencies', $this->id);
|
||||
}
|
||||
|
||||
public function getContractTemplateObligationHashIdAttribute()
|
||||
{
|
||||
return Hasher::encode('contract_template_obligations', $this->contract_template_obligation_id);
|
||||
}
|
||||
|
||||
public function getDependContractTemplateObligationHashIdAttribute()
|
||||
{
|
||||
return Hasher::encode('contract_template_obligations', $this->depend_contract_template_obligation_id);
|
||||
}
|
||||
|
||||
public function getContractTemplateObligationListAttribute()
|
||||
{
|
||||
return $this->contract_template_obligation()->get()->makeHidden(['contract_template_obligation_dependency_list']);
|
||||
}
|
||||
|
||||
public function getDependContractTemplateObligationListAttribute()
|
||||
{
|
||||
return $this->depend_contract_template_obligation()->get()->makeHidden(['contract_template_obligation_dependency_list']);
|
||||
}
|
||||
|
||||
public function getUpdatedAtAttribute($date)
|
||||
{
|
||||
return $date ? Carbon::parse($date)->timezone('Asia/Kuala_Lumpur')->format('Y-m-d') : '';
|
||||
}
|
||||
|
||||
public function getCreatedAtAttribute($date)
|
||||
{
|
||||
return $date ? Carbon::parse($date)->timezone('Asia/Kuala_Lumpur')->format('Y-m-d') : '';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user