PHP code example of hamidne / laravel-media-library-temp
1. Go to this page and download the library: Download hamidne/laravel-media-library-temp 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/ */
hamidne / laravel-media-library-temp 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');