1. Go to this page and download the library: Download aammui/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/ */
aammui / laravel-media example snippets
use Aammui\LaravelMedia\Traits\HasMedia;
use Illuminate\Database\Eloquent\Model;
class Document extends Model
{
use HasMedia;
}
use Aammui\LaravelMedia\Facades\Media;
use Aammui\LaravelMedia\Enum\Responsive;
Media::ofSize([Responsive::SM,Responsive::MD])
->addMedia(request()->file);
use Aammui\LaravelMedia\Facades\Media; // Use Media facade instead
Media::addMedia(request()->file); // returns Media Object
Media::toCollection('profilePicture')
->addMedia(request()->file); // returns Media Object while storing grouping files in profilepicture
Media::toCollection('profilePicture')
->toStorage('s3')
->addMedia(request()->file); // returns Media Object while storing files in s3