added module installed event

This commit is contained in:
denisdulici
2017-11-02 12:07:15 +03:00
parent dfac921e97
commit c7f7d2fdfc
3 changed files with 26 additions and 3 deletions

View File

@ -2,6 +2,7 @@
namespace App\Console\Commands;
use App\Events\ModuleInstalled;
use App\Models\Module\Module;
use App\Models\Module\ModuleHistory;
use Illuminate\Console\Command;
@ -40,6 +41,7 @@ class ModuleInstall extends Command
$module = LaravelModule::findByAlias($model->alias);
// Add history
$data = [
'company_id' => $this->argument('company_id'),
'module_id' => $model->id,
@ -50,6 +52,12 @@ class ModuleInstall extends Command
ModuleHistory::create($data);
// Update database
$this->call('migrate', ['--force' => true]);
// Trigger event
event(new ModuleInstalled($model->alias));
$this->info('Module installed!');
}
}