Skip to content

Commit

Permalink
docs: update README with gotcha
Browse files Browse the repository at this point in the history
  • Loading branch information
rbondoc96 committed Nov 20, 2024
1 parent 9fbc05a commit 0c0b371
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,15 @@ Due to the large amount of records anticipated to be created, you must create an
return [

'morphs' => [
0 => App\Models\User::class
1 => App\Models\User::class
],

];
```

> [!CAUTION]
> `0` is not a valid key for the morph map, as it will get resolved to `false` in Laravel's morphing logic.
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.

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`.
Expand Down

0 comments on commit 0c0b371

Please sign in to comment.