Skip to content

Commit aefbf04

Browse files
Configure Jetstream classes in providers and separate panels into Admin and App
1 parent 007107f commit aefbf04

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

app/Models/User.php

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,32 @@
1010
use JoelButcher\Socialstream\SetsProfilePhotoFromUrl;
1111
use Laravel\Fortify\TwoFactorAuthenticatable;
1212
use Laravel\Jetstream\HasProfilePhoto;
13+
use Laravel\Jetstream\HasTeams;
1314
use Laravel\Sanctum\HasApiTokens;
1415
use Spatie\Permission\Traits\HasRoles;
1516

1617
class User extends Authenticatable
1718
{
1819
use HasApiTokens;
1920
use HasConnectedAccounts;
20-
use HasFactory;
2121
use HasRoles;
22+
use HasFactory;
2223
use HasProfilePhoto {
2324
HasProfilePhoto::profilePhotoUrl as getPhotoUrl;
2425
}
2526
use Notifiable;
2627
use SetsProfilePhotoFromUrl;
2728
use TwoFactorAuthenticatable;
29+
use HasTeams;
30+
31+
/**
32+
* Get the teams the user belongs to.
33+
*/
34+
public function teams()
35+
{
36+
return $this->belongsToMany(Team::class, 'team_user')->withTimestamps();
37+
}
38+
use Laravel\Jetstream\HasTeams;
2839

2940
/**
3041
* The attributes that are mass assignable.
@@ -79,4 +90,12 @@ public function profilePhotoUrl(): Attribute
7990
? Attribute::get(fn () => $this->profile_photo_path)
8091
: $this->getPhotoUrl();
8192
}
93+
94+
/**
95+
* Get the teams the user owns.
96+
*/
97+
public function ownedTeams()
98+
{
99+
return $this->hasMany(Team::class);
100+
}
82101
}

0 commit comments

Comments
 (0)