addMediaCollection('defaultSingleFile')->singleFile(); $this->addMediaCollection('images'); $this->addMediaCollection('singleForced')->singleFile()->forceFileName(function($name) { return $name.' '.now()->format('Y-m-d'); }); $this->addMediaCollection('multipleForced')->forceFileName(function($name) { return $name.' '.now()->format('Y-m-d'); }); $this->addMediaCollection('singleStoringHook')->singleFile()->storing(function($adder, $fileName) { return $adder->withCustomProperties([ 'use' => 'AAA', 'ttt' => pathinfo($fileName, PATHINFO_FILENAME), ]); }); $this->addMediaCollection('singleWithEvent')->singleFile()->stored(function(Media $media) { Event::dispatch(new MediaStored($media)); }); $this->addMediaCollection('multipleFilesWithEvent')->stored(function(Media $media) { Event::dispatch(new MediaStored($media)); }); } }