Create Disk & Folder for Files module using a seeder

araminho - 2 weeks ago

I would like to create Disk & Folder for Files module using a seeder. And, if possible, upload some files.

I am using "S3" adapter.

william - 1 week ago

Hello, sorry for a late reply.

You could do something like this:


use Illuminate\Database\Seeder;
use Anomaly\FilesModule\Disk\Contract\DiskRepositoryInterface;
use Anomaly\FilesModule\Folder\Contract\FolderRepositoryInterface;

class FolderSeeder extends Seeder
     * Run the database seeds.
     * @return void
    public function run(DiskRepositoryInterface $disks, FolderRepositoryInterface $folders)

        $disk = $disks->create([
            'en'      => [
                'name'        => 'Local',
                'description' => 'A local (public) storage disk.',
            'slug'    => 'local',
            'adapter' => 'anomaly.extension.local_storage_adapter',

                'en'            => [
                    'name'        => 'Images',
                    'description' => 'A folder for images.',
                'slug'          => 'images',
                'disk'          => $disk,
                'allowed_types' => [

araminho - 1 week ago

Hi William. Thank you for your answer. It was helpful for creating a disk with local storage adapter. But how can I create a disk using S3 adapter? It has some more parameters that I'll need to pass somehow - "Access Key", "Secret Key", "Region" and "Bucket". How should I indicate those parameters?