mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/unity.git
synced 2026-08-19 04:13:58 +00:00
clone contract UI
This commit is contained in:
@@ -2,10 +2,49 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use App\Http\Helpers\Hasher;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class ContractEntity extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'contract_entities';
|
||||
|
||||
protected $appends = ['hash_id', 'contract_list', 'entity_list'];
|
||||
|
||||
public function contract()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Contract', 'contract_id');
|
||||
}
|
||||
|
||||
public function entity()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Entity', 'entity_id');
|
||||
}
|
||||
|
||||
public function getHashIdAttribute()
|
||||
{
|
||||
return Hasher::encode('contract_entities', $this->id);
|
||||
}
|
||||
|
||||
public function getContractListAttribute()
|
||||
{
|
||||
return $this->contract()->get()->makeHidden(['contract_entity_list']);
|
||||
}
|
||||
|
||||
public function getEntityListAttribute()
|
||||
{
|
||||
return $this->entity()->get()->makeHidden(['entity_signature_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