1. Go to this page and download the library: Download yoelpc4/laravel-media 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/ */
yoelpc4 / laravel-media example snippets
class User extends \Illuminate\Database\Eloquent\Model implements \Yoelpc4\LaravelMedia\Contracts\Mediable {
use \Yoelpc4\LaravelMedia\Concerns\InteractsWithMedia;
/**
* User morph one profile image
*
* @return \Illuminate\Database\Eloquent\Relations\MorphOne
*/
public function profileImage()
{
return $this->morphOne(\Yoelpc4\LaravelMedia\Models\Media::class, 'mediable')->whereGroup('profile image');
}
}
/**
* @inheritDoc
*/
public function registerMediaGroups()
{
$this->addMediaGroup('contract document')
->setMimeTypes('application/pdf')
->setMaxFileLimit(3);
}