belongsTo(Corporate::class); } public function setCodeAttribute($value) { $this->attributes['code'] = !empty($value) ? $value : Str::upper(Str::random('6')); } // public function setPolicyIdAttribute($value) // { // $this->attributes['policy_id'] = !empty($value) ? $value : Str::upper(Str::random('6')); // } public function setStartAttribute($value) { $this->attributes['start'] = !empty($value) ? Carbon::parse($value)->format('Y-m-d') : null; } public function setEndAttribute($value) { $this->attributes['end'] = !empty($value) ? Carbon::parse($value)->format('Y-m-d') : null; } }