From 5fb1067f49ad1337baa23fabc2b126dfd1c62b5c Mon Sep 17 00:00:00 2001 From: denisdulici Date: Wed, 9 May 2018 22:22:02 +0300 Subject: [PATCH] added company id to module install event --- app/Console/Commands/ModuleInstall.php | 6 ++++-- app/Events/ModuleInstalled.php | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/Console/Commands/ModuleInstall.php b/app/Console/Commands/ModuleInstall.php index ee2528627..4e279a217 100644 --- a/app/Console/Commands/ModuleInstall.php +++ b/app/Console/Commands/ModuleInstall.php @@ -41,9 +41,11 @@ class ModuleInstall extends Command $module = LaravelModule::findByAlias($model->alias); + $company_id = $this->argument('company_id'); + // Add history $data = [ - 'company_id' => $this->argument('company_id'), + 'company_id' => $company_id, 'module_id' => $model->id, 'category' => $module->get('category'), 'version' => $module->get('version'), @@ -56,7 +58,7 @@ class ModuleInstall extends Command $this->call('migrate', ['--force' => true]); // Trigger event - event(new ModuleInstalled($model->alias)); + event(new ModuleInstalled($model->alias, $company_id)); $this->info('Module installed!'); } diff --git a/app/Events/ModuleInstalled.php b/app/Events/ModuleInstalled.php index 7846ecd91..b581eb539 100644 --- a/app/Events/ModuleInstalled.php +++ b/app/Events/ModuleInstalled.php @@ -6,13 +6,17 @@ class ModuleInstalled { public $alias; + public $company_id; + /** * Create a new event instance. * * @param $alias + * @param $company_id */ - public function __construct($alias) + public function __construct($alias, $company_id) { $this->alias = $alias; + $this->company_id = $company_id; } } \ No newline at end of file