Skip to content

Commit 03fbc25

Browse files
author
Mostafa Kamal
committed
relationship
1 parent 1f284ab commit 03fbc25

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

web-developer/laravel/tips/relationship.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ toc_max: 4
3737

3838
* `hasManyThrough('Model\Name','Model\Name1','foreign_key1','foreign_key','local_key','local_key1')`
3939

40+
### Polymorphic
41+
42+
* `$this->morphTo();` -> `App\Image`
43+
* `$this->morphOne('App\Image', 'imageable')`
44+
45+
~
46+
47+
* `imageable_type -> model/name`
48+
* `imageable_id -> id`
49+
4050
## Eager Loading
4151

4252
```php

0 commit comments

Comments
 (0)