PHP code example of leandrodiogenes / laravel-medialibrary
1. Go to this page and download the library: Download leandrodiogenes/laravel-medialibrary 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/ */
leandrodiogenes / laravel-medialibrary example snippets
$newsItem = News::find(1);
$newsItem->addMedia($pathToFile)->toMediaCollection('images');
$newsItem->addMedia($request->file('image'))->toMediaCollection('images');
$newsItem->addMedia($smallFile)->toMediaCollection('downloads', 'local');
$newsItem->addMedia($bigFile)->toMediaCollection('downloads', 's3');