PHP code example of vidwan / tenant-buckets

1. Go to this page and download the library: Download vidwan/tenant-buckets 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/ */

    

vidwan / tenant-buckets example snippets


        's3' => [
            'driver' => 's3',
            'key' => env('AWS_ACCESS_KEY_ID'),
            'secret' => env('AWS_SECRET_ACCESS_KEY'),
            'region' => env('AWS_DEFAULT_REGION'),
            'bucket' => env('AWS_BUCKET'),
            'url' => env('AWS_URL'),
            'endpoint' => env('AWS_ENDPOINT'),
            'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
        ],


Vidwan\TenantBuckets\Bootstrappers\TenantBucketBootstrapper::class

    'bootstrappers' => [
        // Tenancy Bootstrappers
        Vidwan\TenantBuckets\Bootstrappers\TenantBucketBootstrapper::class,
    ],

    'filesystem' => [
        'suffix_base' => 'tenant',
        'disks' => [
            'local',
            'public',
            // 's3', // Make sure this stays commented
        ],
    ],


use Vidwan\TenantBuckets\Jobs\CreateTenantBucket;
use Vidwan\TenantBuckets\Jobs\DeleteTenantBucket;

...

    public function events()
    {
        return [
            // Tenant events
            ...
            Events\TenantCreated::class => [
                JobPipeline::make([
                    Jobs\CreateDatabase::class,
                    Jobs\MigrateDatabase::class,
                    Jobs\SeedDatabase::class,
                    // Your own jobs to prepare the tenant.
                    // Provision API keys, create S3 buckets, anything you want!
                    CreateTenantBucket::class, // <-- Place it Here
					
                ])->send(function (Events\TenantCreated $event) {
                    return $event->tenant;
                })->shouldBeQueued(false),
            ],
            ...
            Events\DeletingTenant::class => [
                JobPipeline::make([
                    DeleteTenantBucket::class, // <-- Place it Here
                ])->send(function (Events\DeletingTenant $event) {
                    return $event->tenant;
                })->shouldBeQueued(false),
            ],
            ...
        ];
    }