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
+3-4Lines changed: 3 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -142,13 +142,12 @@ php artisan morph-map:clear
142
142
You can also determine morph class values programmatically by using a custom resolver. For example, you could use the following to automatically derive the value based on the singular form of the model's table name:
143
143
144
144
```php
145
-
use Illuminate\Support\Str;
146
-
use Spatie\LaravelMorphMapGenerator\MorphMapGenerator;
You may set the resolver in the `boot` method of your `AppServiceProvider` or a separate service provider if needed.
148
+
Be warned! When the output of the closure above is not stable then you'll manually need to update all the `morhp_type` columns within your database. Using something like the table name is a good idea since those do not change that often.
149
+
150
+
You may set the resolver in the `boot` method of one of your service providers.
0 commit comments