|
145 | 145 | "Laravel Model: One to One Relationship": { |
146 | 146 | "prefix": "Model::oo", |
147 | 147 | "body": [ |
| 148 | + "/**", |
| 149 | + " * Get the $1 associated with the ${TM_FILENAME_BASE}", |
| 150 | + " *", |
| 151 | + " * @return \\Illuminate\\Database\\Eloquent\\Relations\\HasOne", |
| 152 | + " */", |
148 | 153 | "public function $1()", |
149 | 154 | "{", |
150 | | - "\treturn \\$this->hasOne('App\\\\$0');", |
| 155 | + "\treturn \\$this->hasOne($0::class);", |
151 | 156 | "}" |
152 | 157 | ], |
153 | 158 | "description": "One to One: Define a One to One relationship within your model." |
154 | 159 | }, |
155 | 160 | "Laravel Model: Belongs To Relationship": { |
156 | 161 | "prefix": "Model::bt", |
157 | 162 | "body": [ |
| 163 | + "/**", |
| 164 | + " * Get the $1 that owns the ${TM_FILENAME_BASE}", |
| 165 | + " *", |
| 166 | + " * @return \\Illuminate\\Database\\Eloquent\\Relations\\BelongsTo", |
| 167 | + " */", |
158 | 168 | "public function $1()", |
159 | 169 | "{", |
160 | | - "\treturn \\$this->belongsTo('App\\\\$0');", |
| 170 | + "\treturn \\$this->belongsTo($0::class);", |
161 | 171 | "}" |
162 | 172 | ], |
163 | 173 | "description": "Belongs To: Define a Belongs To relationship within your model." |
164 | 174 | }, |
165 | 175 | "Laravel Model: One to Many": { |
166 | 176 | "prefix": "Model::om", |
167 | 177 | "body": [ |
| 178 | + "/**", |
| 179 | + " * Get all of the $1 for the ${TM_FILENAME_BASE}", |
| 180 | + " *", |
| 181 | + " * @return \\Illuminate\\Database\\Eloquent\\Relations\\HasMany", |
| 182 | + " */", |
168 | 183 | "public function $1()", |
169 | 184 | "{", |
170 | | - "\treturn \\$this->hasMany('App\\\\$0');", |
| 185 | + "\treturn \\$this->hasMany($0::class);", |
171 | 186 | "}" |
172 | 187 | ], |
173 | 188 | "description": "One to Many: Define a One to Many relationship within your model." |
174 | 189 | }, |
175 | 190 | "Laravel Model: Many to Many": { |
176 | 191 | "prefix": "Model::mm", |
177 | 192 | "body": [ |
| 193 | + "/**", |
| 194 | + " * The $1 that belong to the ${TM_FILENAME_BASE}", |
| 195 | + " *", |
| 196 | + " * @return \\Illuminate\\Database\\Eloquent\\Relations\\BelongsToMany", |
| 197 | + " */", |
178 | 198 | "public function $1()", |
179 | 199 | "{", |
180 | | - "\treturn \\$this->belongsToMany('App\\\\$0');", |
| 200 | + "\treturn \\$this->belongsToMany($0::class);", |
181 | 201 | "}" |
182 | 202 | ], |
183 | 203 | "description": "Many to Many: Define a Many to Many relationship within your model." |
184 | 204 | }, |
185 | 205 | "Laravel Model: Belongs to Many": { |
186 | 206 | "prefix": "Model::btm", |
187 | 207 | "body": [ |
| 208 | + "/**", |
| 209 | + " * The $1 that belong to the ${TM_FILENAME_BASE}", |
| 210 | + " *", |
| 211 | + " * @return \\Illuminate\\Database\\Eloquent\\Relations\\BelongsToMany", |
| 212 | + " */", |
188 | 213 | "public function $1()", |
189 | 214 | "{", |
190 | | - "\treturn \\$this->belongsToMany('App\\\\$0');", |
| 215 | + "\treturn \\$this->belongsToMany($0::class);", |
191 | 216 | "}" |
192 | 217 | ], |
193 | 218 | "description": "Belongs to Many: Define a Belongs to Many relationship within your model." |
194 | 219 | }, |
195 | 220 | "Laravel Model: Has Many Through": { |
196 | 221 | "prefix": "Model::hmt", |
197 | 222 | "body": [ |
| 223 | + "/**", |
| 224 | + " * Get all of the $1 for the ${TM_FILENAME_BASE}", |
| 225 | + " *", |
| 226 | + " * @return \\Illuminate\\Database\\Eloquent\\Relations\\HasManyThrough", |
| 227 | + " */", |
198 | 228 | "public function $1()", |
199 | 229 | "{", |
200 | | - "\treturn \\$this->hasManyThrough('App\\\\$0');", |
| 230 | + "\treturn \\$this->hasManyThrough($0::class);", |
201 | 231 | "}" |
202 | 232 | ], |
203 | 233 | "description": "Has Many Through: Define a Has Many Through relationship within your model." |
204 | 234 | }, |
205 | 235 | "Laravel Model: Has One Through": { |
206 | 236 | "prefix": "Model::hot", |
207 | 237 | "body": [ |
| 238 | + "/**", |
| 239 | + " * Get the $1 associated with the ${TM_FILENAME_BASE}", |
| 240 | + " *", |
| 241 | + " * @return \\Illuminate\\Database\\Eloquent\\Relations\\HasOneThrough", |
| 242 | + " */", |
208 | 243 | "public function $1()", |
209 | 244 | "{", |
210 | | - "\treturn \\$this->hasOneThrough('App\\\\$2', 'App\\\\$3');", |
| 245 | + "\treturn \\$this->hasOneThrough($2::class, $3::class);", |
211 | 246 | "}" |
212 | 247 | ], |
213 | 248 | "description": "Has One Through: Define a Has One Through relationship within your model. (5.8+)" |
|
0 commit comments