mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/unity.git
synced 2026-08-19 12:24:01 +00:00
contract template endpoint
This commit is contained in:
@@ -2,21 +2,39 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Http\Helpers\Hasher;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class ContractTemplate extends Model
|
||||
{
|
||||
protected $table = 'contract_templates';
|
||||
|
||||
protected $appends = ['contract_template_obligation_list'];
|
||||
protected $appends = ['hash_id', 'contract_template_obligation_list'];
|
||||
|
||||
public function contract_template_obligation()
|
||||
{
|
||||
return $this->hasMany('App\Models\ContractTemplateObligation', 'contract_template_id');
|
||||
}
|
||||
|
||||
public function getHashIdAttribute()
|
||||
{
|
||||
return Hasher::encode('contract_templates', $this->id);
|
||||
}
|
||||
|
||||
public function getContractTemplateObligationListAttribute()
|
||||
{
|
||||
return $this->contract_template_obligation()->get();
|
||||
}
|
||||
|
||||
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