PHP code example of sommer / wn-multidb-plugin

1. Go to this page and download the library: Download sommer/wn-multidb-plugin 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/ */

    

sommer / wn-multidb-plugin example snippets


class Product extends Model
{
	use \Sommer\Multidb\Traits\UsesTenantConnection;

	...
}

class Product extends Model
{
    use \Sommer\Multidb\Traits\UsesMainConnection;

    ...
}

class Summaries extends Controller
{
    /**
     * @var array
     */
    public $implement = [
        'Backend\Behaviors\ListController',
        'Backend\Behaviors\FormController',
        'Sommer\MultiDB\Behaviors\TenantSelectionBehavior', // <-- add this line
    ];
}

class Product extends Model
{
	use \Sommer\Multidb\Traits\UsesTenantConnection;

	...

	public $attachMany = [
        'images' => [
            'Sommer\Multidb\Models\File',
            'softDelete' => true,
        ],
    ];

    ...
}