- How do I install sertxudeveloper/laravel-media-model in a Laravel app?
- Install it with Composer using composer require sertxudeveloper/laravel-media-model. Then publish the package migrations and configuration if applicable, run php artisan migrate, and add the package trait to the Eloquent models that should own media. Confirm the exact publish tags and trait name in the package source because the provided README excerpt is empty.
- Does laravel-media-model support Laravel 11?
- Yes, version 1.3.0 explicitly adds Laravel 11.x support according to the release notes. That removes a major compatibility blocker for teams on Laravel 11. You should still check the package composer.json for exact Laravel and PHP constraints before upgrading an existing project.
- How do I attach an image or file to an Eloquent model?
- The package is designed around a dedicated Media model and reusable relationships, so you typically add its trait to a target model and create or associate media records through that relationship. The assessment describes polymorphic model-to-file attachment, meaning one model can own media while the Media record stores the file reference. Review the package source for the exact method names and relationship conventions.
- What storage disks does laravel-media-model support?
- It appears to integrate with Laravel's filesystem abstraction, so local disks and S3-compatible disks are the expected path, but the release notes do not enumerate supported drivers. Validate your target disk, URL generation, and CDN behavior in a sandbox before committing. Confirm configuration keys in the published config file.
- Is laravel-media-model a replacement for Spatie Media Library?
- No, it is better treated as a lightweight attachment package rather than a full media library replacement. The assessment notes it is not intended for advanced transformations, responsive image generation, multi-tenant isolation, or a mature media API. If your product depends on conversions or responsive images, use a dedicated media library or add that capability separately.
- Does it support image conversions, thumbnails, or queued processing?
- The available information describes straightforward media attachment, not image conversions, responsive image generation, or queued processing. Treat it as attachment-only unless the package source documents conversion features. For thumbnails or derived images, pair it with a dedicated image processing package or use Spatie Media Library instead.
- How are file deletion and orphaned media handled?
- The provided release notes do not document deletion hooks, soft-delete behavior, or orphan cleanup. Plan to handle file lifecycle explicitly, such as deleting media when a parent model is removed and running a scheduled cleanup for orphaned records. Review the package migrations and trait behavior before relying on automatic cleanup.
- What Laravel and PHP versions are supported?
- Version 1.3.0 adds Laravel 11 support, but the release notes do not confirm whether Laravel 9 and 10 remain supported or which PHP versions are covered. Check the package composer.json and CI matrix for the authoritative constraints. Pin the package version in composer.json until compatibility is proven for your stack.
- Is laravel-media-model mature enough for production use?
- It appears actively maintained, but the project is pre-2.0 and likely maintained by a small team, so API stability and broad production adoption are not strongly evidenced. For production, pin the version, review the source, and pilot it on one non-critical model first. Also validate storage, security, backup, and URL stability concerns in your environment.
- How do I migrate from custom media tables or another media package?
- Plan a data migration rather than a direct switch: map existing file paths, metadata, and ownership to the package's Media schema, then backfill in staging first. If migrating from Spatie Media Library or custom tables, expect schema and filesystem convention differences and run both systems in parallel during validation. Test reads and writes before removing the old implementation.