Skip to content

Commit

Permalink
Configure Jetstream classes in providers and separate panels into Adm…
Browse files Browse the repository at this point in the history
…in and App
  • Loading branch information
curtisdelicata committed Jun 29, 2024
1 parent b005802 commit 9fff62f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use JoelButcher\Socialstream\SetsProfilePhotoFromUrl;
use Laravel\Fortify\TwoFactorAuthenticatable;
use Laravel\Jetstream\HasProfilePhoto;
use Laravel\Jetstream\HasTeams;
use Laravel\Sanctum\HasApiTokens;
use Spatie\Permission\Traits\HasRoles;

Expand All @@ -25,6 +26,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.
Expand Down Expand Up @@ -79,4 +90,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);
}
}

0 comments on commit 9fff62f

Please sign in to comment.