mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/unity.git
synced 2026-08-19 04:13:58 +00:00
contract template obligation api
This commit is contained in:
@@ -25,7 +25,7 @@ class ContractTemplate extends Model
|
||||
|
||||
public function getContractTemplateObligationListAttribute()
|
||||
{
|
||||
return $this->contract_template_obligation()->get();
|
||||
return $this->contract_template_obligation()->get()->makeHidden(['contract_template_list']);
|
||||
}
|
||||
|
||||
public function getUpdatedAtAttribute($date)
|
||||
|
||||
@@ -2,10 +2,39 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use App\Http\Helpers\Hasher;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class ContractTemplateObligation extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'contract_template_obligations';
|
||||
|
||||
protected $appends = ['hash_id', 'contract_template_list'];
|
||||
|
||||
public function contract_template()
|
||||
{
|
||||
return $this->belongsTo('App\Models\ContractTemplate', 'contract_template_id');
|
||||
}
|
||||
|
||||
public function getHashIdAttribute()
|
||||
{
|
||||
return Hasher::encode('contract_template_obligations', $this->id);
|
||||
}
|
||||
|
||||
public function getContractTemplateListAttribute()
|
||||
{
|
||||
return $this->contract_template()->get()->makeHidden(['contract_template_obligation_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') : '';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ContractTemplateObligationLog extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
Reference in New Issue
Block a user