Custom Model
You can replace the default Media model with your own to add relationships, columns, scopes, or observer hooks specific to your application.
Create your model
Extend the package base model:
Register it
Point the config at your model:
Custom table name
Override $table on your model. The migration uses app(config('media.model'))->getTable(), so it will automatically create the correct table name:
Adding pivot data to toMediaArray()
When media is attached via a BelongsToMany pivot, you may need extra pivot columns in the serialised array returned to the picker. Override pivotMediaArray():
See Pivot Columns for the full setup.
Custom observer logic
The package registers MediaObserver automatically. To add your own observer behaviour without conflicting, register a second observer in your AppServiceProvider:
Both observers will fire — the package observer handles URL generation and cache invalidation; yours handles application-specific logic.