From 900b88f8d4a799ef61782c1aaae4051a90a15934 Mon Sep 17 00:00:00 2001 From: Curtis Delicata Date: Mon, 1 Jul 2024 02:21:55 +0000 Subject: [PATCH] Add teams model --- app/Models/Team.php | 223 ++++++++++++++++++++++++++++++++++ app/Models/TeamInvitation.php | 28 +++++ 2 files changed, 251 insertions(+) create mode 100644 app/Models/Team.php create mode 100644 app/Models/TeamInvitation.php diff --git a/app/Models/Team.php b/app/Models/Team.php new file mode 100644 index 00000000..6aba5a45 --- /dev/null +++ b/app/Models/Team.php @@ -0,0 +1,223 @@ + + */ + protected $fillable = [ + 'name', + 'personal_team', + ]; + + /** + * The event map for the model. + * + * @var array + */ + protected $dispatchesEvents = [ + 'created' => TeamCreated::class, + 'updated' => TeamUpdated::class, + 'deleted' => TeamDeleted::class, + ]; + + /** + * Get the attributes that should be cast. + * + * @return array + */ + protected function casts(): array + { + return [ + 'personal_team' => 'boolean', + ]; + } + + public function addrs(): HasMany + { + return $this->hasMany(Addr::class); + } + + public function authors(): HasMany + { + return $this->hasMany(Author::class); + } + + public function categories(): HasMany + { + return $this->hasMany(Category::class); + } + + public function chans(): HasMany + { + return $this->hasMany(Chan::class); + } + + public function citations(): HasMany + { + return $this->hasMany(Citation::class); + } + + public function companies(): HasMany + { + return $this->hasMany(Company::class); + } + + public function conversations(): HasMany + { + return $this->hasMany(Conversation::class); + } + + public function dnas(): HasMany + { + return $this->hasMany(Dna::class); + } + + public function dna_matchings(): HasMany + { + return $this->hasMany(DnaMatching::class); + } + + public function families(): HasMany + { + return $this->hasMany(Family::class); + } + + public function family_events(): HasMany + { + return $this->hasMany(FamilyEvent::class); + } + + public function family_slgs(): HasMany + { + return $this->hasMany(FamilySlgs::class); + } + + public function gedcoms(): HasMany + { + return $this->hasMany(Gedcom::class); + } + + public function geneanums(): HasMany + { + return $this->hasMany(Geneanum::class); + } + + public function messages(): HasMany + { + return $this->hasMany(Message::class); + } + + public function notes(): HasMany + { + return $this->hasMany(Note::class); + } + + public function persons(): HasMany + { + return $this->hasMany(Person::class); + } + + public function people(): HasMany + { + return $this->hasMany(Person::class); + } + + public function person_alias(): HasMany + { + return $this->hasMany(PersonAlia::class); + } + + public function person_ancis(): HasMany + { + return $this->hasMany(PersonAnci::class); + } + + public function person_assos(): HasMany + { + return $this->hasMany(PersonAsso::class); + } + + public function person_events(): HasMany + { + return $this->hasMany(PersonEvent::class); + } + + public function person_lds(): HasMany + { + return $this->hasMany(PersonLds::class); + } + + public function person_names(): HasMany + { + return $this->hasMany(PersonName::class); + } + + public function person_name_fones(): HasMany + { + return $this->hasMany(PersonNameFone::class); + } + + public function person_subms(): HasMany + { + return $this->hasMany(PersonSubm::class); + } + + public function places(): HasMany + { + return $this->hasMany(Place::class); + } + + public function publications(): HasMany + { + return $this->hasMany(Publication::class); + } + + public function refns(): HasMany + { + return $this->hasMany(Refn::class); + } + + public function repositories(): HasMany + { + return $this->hasMany(Repository::class); + } + + public function sources(): HasMany + { + return $this->hasMany(Source::class); + } + + public function source_data(): HasMany + { + return $this->hasMany(SourceData::class); + } + + public function subms(): HasMany + { + return $this->hasMany(Subm::class); + } + + public function subns(): HasMany + { + return $this->hasMany(Subn::class); + } + + public function trees(): HasMany + { + return $this->hasMany(Tree::class); + } +} diff --git a/app/Models/TeamInvitation.php b/app/Models/TeamInvitation.php new file mode 100644 index 00000000..a1d432ef --- /dev/null +++ b/app/Models/TeamInvitation.php @@ -0,0 +1,28 @@ + + */ + protected $fillable = [ + 'email', + 'role', + ]; + + /** + * Get the team that the invitation belongs to. + */ + public function team(): BelongsTo + { + return $this->belongsTo(Jetstream::teamModel()); + } +}