'datetime', 'active' => 'boolean', 'birthday' => 'date:Y-m-d', ]; public function groups(){ return $this->belongsToMany(Group::class, GroupUser::class); } public function department(){ return $this->belongsTo(Department::class); } public function title(){ return $this->belongsTo(Title::class); } public function createdDocuments(){ return $this->hasMany(Document::class, 'creator_id'); } public function wroteDocuments(){ return $this->hasMany(Document::class, 'writer_id'); } public function receivedDocuments(){ return $this->belongsToMany(Document::class, 'document_receivers'); } public function getDocumentsAttribute(){ return $this->createdDocuments->merge($this->receivedDocuments)->merge($this->wroteDocuments()); } }