Changing database in console commands

I am writing a new console command based on the code given in the ‘Building Authorization Data’ section of the Authorization documentation for Yii2. I have two databases which I have set up in the common/main-local.php file. One is called db and the other is called db1. When I run the command yii rbac/init it populates the db database but I do not know how to get it to populate db1. I can modify the common/main-local.php file and rename db1 to db and then run yii rbac/init and this works. But is there a way to select db1 either by using a command line option (I tried yii rbac/init --db=db1, but it did’nt work) or writing some code in the RbacController to select db1. I dont mind having RbacDb1Controller and rbacDbController files.

My controller code is below

<?php

namespace console\controllers;

use Yii;

use yii\console\Controller;

use yii\base\Exception;

class RbacController extends Controller

{

public function actionInit()


{


			


	&#036;auth = Yii::&#036;app-&gt;authManager;


	


	


	try{


		// add &quot;admin&quot; role and give this role the &quot;updatePost&quot; permission


		// as well as the permissions of the &quot;author&quot; role


		&#036;admin = &#036;auth-&gt;createRole('admin');


		&#036;auth-&gt;add(&#036;admin);


	}


	catch(Exception &#036;e){


		echo &quot;WARNING: admin already exists.&#092;n&quot;;


	}





	try{


	// Assign roles to users. IDs returned by IdentityInterface::getId()


	// usually implemented in your User model.


	


	&#036;auth-&gt;assign(&#036;admin, 1);


	}


	catch(Exception &#036;e){


		echo &quot;WARNING: Cannot assign admin to user id 1.&#092;n&quot;;


	}	


}

}

?>

Any help would be greatly appreciated.

Regards,

David