use HasMedia;
public function mediaConvert(MediaConverter $converter)
{
$converter->optimize();
$converter->conversion('thumb')->fit_crop(800, 450);
}
{{ $model->mediaInput(['multiple' => true, 'mime' => 'image/*']) }}
$model->updateMediaFromInput();
const media = require('./../../vendor/febalist/laravel-media/src/media');
media.select_images().then(files => {
media.upload(files, {
model_type: 'App\\User',
model_id: 1,
onprogress: function(progress, uploaded, event) {
console.log({progress, uploaded, event});
},
onuploaded: function(result, error, file) {
console.log({result, error, file});
},
}).then(results => {
console.log(results);
});
});