1. Go to this page and download the library: Download imagina/media-module library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
/**
* Media Fillable
*/
public $mediaFillable = [
'mainimage' => 'single'
];
/**
* 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();
}
php
//Implementation with Media
return [
'files' => $this->whenLoaded('files', fn() => $this->files->byZones($this->mediaFillable, $this)),
];
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.