imagina / imedia-module
Imagina imedia laravel module
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 20
Type:laravel-module
Requires
- php: ^8.1
- composer/installers: ~1.0
- guzzlehttp/psr7: ^2.6
- imagina/tag-module: ^10.0
- intervention/image: ^2.5
Requires (Dev)
- doctrine/dbal: ^3.5
- friendsofphp/php-cs-fixer: ^3.27.0
- league/flysystem-aws-s3-v3: ^3.0
- mockery/mockery: ^1.4.4
- orchestra/testbench: ^8.5
- phpunit/phpunit: ^10
- dev-main
- v12.x-dev
- v10.x-dev
- 10.0.0
- v8.x-dev
- 3.6.1
- 3.6.0
- 3.5.3
- 3.5.2
- 3.5.1
- 3.5.0
- 3.4.0
- 3.3.0
- 3.2.1
- 3.2.0
- 3.1.1
- 3.1.0
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- 2.6.1
- 2.6.0
- 2.5.2
- 2.5.1
- 2.5.0
- 2.4.0
- 2.3.0
- 2.2.0
- 2.1.0
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.26.0
- 1.25.8
- 1.25.7
- 1.25.6
- 1.25.5
- 1.25.4
- 1.25.3
- 1.25.2
- 1.25.1
- 1.25.0
- 1.24.1
- 1.24.0
- 1.23.1
- 1.23.0
- 1.22.1
- 1.22.0
- 1.21.0
- 1.20.1
- 1.20.0
- 1.19.0
- 1.18.1
- 1.18.0
- 1.17.2
- 1.17.1
- 1.17.0
- 1.16.0
- 1.15.1
- 1.15.0
- 1.14.2
- 1.14.1
- 1.14.0
- 1.13.0
- 1.12.0
- 1.11.0
- 1.10.0
- 1.9.0
- 1.8.0
- 1.7.0
- 1.6.0
- 1.5.0
- 1.4.0
- 1.3.1
- 1.3.0
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.1
- 1.1.0
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- 0.1.0-beta.1
This package is auto-updated.
Last update: 2025-08-29 22:25:26 UTC
README
Private Files Configurations
- The bucker must have the permissions configured correctly
- Read and write should be set only for the allowed user
Implementation with Modules
In the Entity (Models/Entity)
- Add Events
public array $dispatchesEventsWithBindings = [ 'created' => [['path' => 'Modules\Imedia\Events\CreateMedia']], 'creating' => [], 'updated' => [['path' => 'Modules\Imedia\Events\UpdateMedia']], 'updating' => [], 'deleting' => [['path' => 'Modules\Imedia\Events\DeleteMedia']], 'deleted' => [] ];
- Add the zones
/** * Media Fillable */ public $mediaFillable = [ 'mainimage' => 'single' ];
- Add relation:
/** * Relation Media * Make the Many To Many Morph */ public function files() { if (isModuleEnabled('Imedia')) { return app(\Modules\Imedia\Relations\FilesRelation::class)->resolve($this); } return new \Imagina\Icore\Relations\EmptyRelation(); }
In Transformer (Transformers/EntityTransformer)
- Add relation with files
//Implementation with Media return [ 'files' => $this->whenLoaded('files', fn() => $this->files->byZones($this->mediaFillable, $this)), ];
Endpoint | Attributes Example
- To Media single , add zone and file id.
attributes[medias_single][$zone] = $fileId
Example: Zone = mainimage
attributes[medias_single][mainimage] = 1
- To Media gallery, add zone and files array ids.
attributes[medias_multi][$zone][files][] = $fileId
Example: Zone = gallery
attributes[medias_multi][gallery][files][] = 1
attributes[medias_multi][gallery][files][] = 2