'array', ]; public function imports() { return $this->morphMany(ImportLog::class, 'importable'); } public function files() { return $this->morphMany(File::class, 'fileable'); } public function policies() { return $this->hasMany(CorporatePolicy::class); } public function currentPolicy() { return $this->hasOne(CorporatePolicy::class) // ->where('start', '<=', now()) // ->where('end', '>=', now()) ->where('active', true) ->latestOfMany(); } public function corporatePlans() { return $this->hasMany(CorporatePlan::class, 'corporate_id'); } public function corporateBenefits() { return $this->hasMany(CorporateBenefit::class, 'corporate_id'); } public function corporateDivisions() { return $this->hasMany(CorporateDivision::class, 'corporate_id'); } public function employees() { return $this->belongsToMany(Member::class, 'corporate_employees', 'corporate_id', 'member_id')->withPivot([ 'branch_code', 'division_id', 'nik', 'status', 'start', 'end' ]); } public function importLogs() { return $this->morphMany(ImportLog::class, 'importable'); } public function services() { return $this->hasManyThrough(CorporateService::class, Service::class, 'corporate_id', 'service_code', 'id', 'service_code'); } public function corporateServices() { return $this->hasMany(CorporateService::class, 'corporate_id'); } public function parent() { return $this->belongsTo(Corporate::class, 'parent_id'); } public function subCorporates() { return $this->hasMany(Corporate::class, 'parent_id'); } }