File tree 1 file changed +20
-1
lines changed
1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change 10
10
use JoelButcher \Socialstream \SetsProfilePhotoFromUrl ;
11
11
use Laravel \Fortify \TwoFactorAuthenticatable ;
12
12
use Laravel \Jetstream \HasProfilePhoto ;
13
+ use Laravel \Jetstream \HasTeams ;
13
14
use Laravel \Sanctum \HasApiTokens ;
14
15
use Spatie \Permission \Traits \HasRoles ;
15
16
16
17
class User extends Authenticatable
17
18
{
18
19
use HasApiTokens;
19
20
use HasConnectedAccounts;
20
- use HasFactory;
21
21
use HasRoles;
22
+ use HasFactory;
22
23
use HasProfilePhoto {
23
24
HasProfilePhoto::profilePhotoUrl as getPhotoUrl;
24
25
}
25
26
use Notifiable;
26
27
use SetsProfilePhotoFromUrl;
27
28
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;
28
39
29
40
/**
30
41
* The attributes that are mass assignable.
@@ -79,4 +90,12 @@ public function profilePhotoUrl(): Attribute
79
90
? Attribute::get (fn () => $ this ->profile_photo_path )
80
91
: $ this ->getPhotoUrl ();
81
92
}
93
+
94
+ /**
95
+ * Get the teams the user owns.
96
+ */
97
+ public function ownedTeams ()
98
+ {
99
+ return $ this ->hasMany (Team::class);
100
+ }
82
101
}
You can’t perform that action at this time.
0 commit comments