added module installed event
This commit is contained in:
parent
dfac921e97
commit
c7f7d2fdfc
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Events\ModuleInstalled;
|
||||||
use App\Models\Module\Module;
|
use App\Models\Module\Module;
|
||||||
use App\Models\Module\ModuleHistory;
|
use App\Models\Module\ModuleHistory;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
@ -40,6 +41,7 @@ class ModuleInstall extends Command
|
|||||||
|
|
||||||
$module = LaravelModule::findByAlias($model->alias);
|
$module = LaravelModule::findByAlias($model->alias);
|
||||||
|
|
||||||
|
// Add history
|
||||||
$data = [
|
$data = [
|
||||||
'company_id' => $this->argument('company_id'),
|
'company_id' => $this->argument('company_id'),
|
||||||
'module_id' => $model->id,
|
'module_id' => $model->id,
|
||||||
@ -50,6 +52,12 @@ class ModuleInstall extends Command
|
|||||||
|
|
||||||
ModuleHistory::create($data);
|
ModuleHistory::create($data);
|
||||||
|
|
||||||
|
// Update database
|
||||||
|
$this->call('migrate', ['--force' => true]);
|
||||||
|
|
||||||
|
// Trigger event
|
||||||
|
event(new ModuleInstalled($model->alias));
|
||||||
|
|
||||||
$this->info('Module installed!');
|
$this->info('Module installed!');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
18
app/Events/ModuleInstalled.php
Normal file
18
app/Events/ModuleInstalled.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Events;
|
||||||
|
|
||||||
|
class ModuleInstalled
|
||||||
|
{
|
||||||
|
public $alias;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new event instance.
|
||||||
|
*
|
||||||
|
* @param $alias
|
||||||
|
*/
|
||||||
|
public function __construct($alias)
|
||||||
|
{
|
||||||
|
$this->alias = $alias;
|
||||||
|
}
|
||||||
|
}
|
@ -201,9 +201,6 @@ trait Modules
|
|||||||
File::copyDirectory($temp_path, $module_path);
|
File::copyDirectory($temp_path, $module_path);
|
||||||
File::deleteDirectory($temp_path);
|
File::deleteDirectory($temp_path);
|
||||||
|
|
||||||
// Update database
|
|
||||||
Artisan::call('migrate', ['--force' => true]);
|
|
||||||
|
|
||||||
Artisan::call('cache:clear');
|
Artisan::call('cache:clear');
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user