*
* @var string
*/
- protected $signature = 'bookstack:regenerate-permissions';
+ protected $signature = 'bookstack:regenerate-permissions {--database= : The database connection to use.}';
/**
* The console command description.
*/
public function handle()
{
+ $connection = \DB::getDefaultConnection();
+ if ($this->option('database') !== null) {
+ \DB::setDefaultConnection($this->option('database'));
+ $this->permissionService->setConnection(\DB::connection($this->option('database')));
+ }
+
$this->permissionService->buildJointPermissions();
+
+ \DB::setDefaultConnection($connection);
$this->comment('Permissions regenerated');
}
}