File tree Expand file tree Collapse file tree 1 file changed +66
-0
lines changed
Expand file tree Collapse file tree 1 file changed +66
-0
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,72 @@ $userlist->companies->delete('company-1');
9090$userlist->companies->delete([ 'identifier' => 'company-1' ]);
9191```
9292
93+ ### Tracking Relationships
94+
95+ #### Creating & updating Relationships
96+
97+ ``` php
98+ $relationship = [
99+ 'user' => 'user-1',
100+ 'company' => 'company-1',
101+ 'properties' => [
102+ 'role' => 'admin'
103+ ]
104+ ];
105+
106+ $userlist->relationships->push($relationship);
107+
108+ $userlist->relationship($relationship); // Alias
109+ $userlist->relationships->create($relationship); // Alias
110+ ```
111+
112+ This is equivalent to specifying the relationship on the user model.
113+
114+ ``` php
115+ $user = [
116+ 'identifier' => 'user-1',
117+ 'relationships' => [
118+ [
119+ 'company' => 'company-1',
120+ 'properties' => [
121+ 'role' => 'admin'
122+ ]
123+ ]
124+ ],
125+ ];
126+
127+ $userlist->users->push($user);
128+ ```
129+
130+ It's also equivalent specifying the relationship on the company model.
131+
132+ ``` php
133+ $company = [
134+ 'identifier' => 'company-1',
135+ 'relationships' => [
136+ [
137+ 'user' => 'user-1',
138+ 'properties' => [
139+ 'role' => 'admin'
140+ ]
141+ ]
142+ ],
143+ ];
144+
145+ $userlist->companies->push($company);
146+ ```
147+
148+ #### Deleting Relationships
149+
150+ ``` php
151+ $relationship = [
152+ 'user' => 'user-1',
153+ 'company' => 'company-1'
154+ ]
155+
156+ $userlist->relationships->delete($relationship);
157+ ```
158+
93159### Tracking Events
94160
95161``` php
You can’t perform that action at this time.
0 commit comments