diff --git a/app/Models/User.php b/app/Models/User.php index ef4c8825..c97f5622 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -23,6 +23,16 @@ class User extends Authenticatable use Notifiable; use SetsProfilePhotoFromUrl; use TwoFactorAuthenticatable; + use HasTeams; + + /** + * Get the teams the user belongs to. + */ + public function teams() + { + return $this->belongsToMany(Team::class, 'team_user')->withTimestamps(); + } + use Laravel\Jetstream\HasTeams; /** * The attributes that are mass assignable. @@ -77,4 +87,12 @@ public function profilePhotoUrl(): Attribute ? Attribute::get(fn () => $this->profile_photo_path) : $this->getPhotoUrl(); } + + /** + * Get the teams the user owns. + */ + public function ownedTeams() + { + return $this->hasMany(Team::class); + } }