You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -59,12 +59,15 @@ Due to the large amount of records anticipated to be created, you must create an
59
59
return [
60
60
61
61
'morphs' => [
62
-
0 => App\Models\User::class
62
+
1 => App\Models\User::class
63
63
],
64
64
65
65
];
66
66
```
67
67
68
+
> [!CAUTION]
69
+
> `0` is not a valid key for the morph map, as it will get resolved to `false` in Laravel's morphing logic.
70
+
68
71
This points our `App\Models\User::class` to an enum (integer). This means our database is created with small integers vs large fully qualified namespaces.
69
72
70
73
Recommended action is creating an enum class to describe all models in your system. If an integer mapping is not detected. The system will error out with an `\InvalidArgumentException`.
0 commit comments