From d934bc419ee759eaf673c379bc1f87ea44694bd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Duli=C3=A7i?= Date: Tue, 21 Jul 2020 00:01:26 +0300 Subject: [PATCH] removed module category from json --- app/Abstracts/Commands/Module.php | 1 - app/Console/Stubs/Modules/json.stub | 1 - app/Http/Controllers/Install/Updates.php | 1 - app/Http/Controllers/Modules/Item.php | 1 - .../Update/CreateModuleUpdatedHistory.php | 1 - app/Listeners/Update/V20/Version2017.php | 29 ++++++++++++++++++ app/Models/Module/ModuleHistory.php | 3 +- app/Providers/Event.php | 1 + app/Traits/Modules.php | 4 --- .../2020_07_20_000000_core_v2017.php | 30 +++++++++++++++++++ .../views/install/updates/index.blade.php | 10 +++---- 11 files changed, 65 insertions(+), 17 deletions(-) create mode 100644 app/Listeners/Update/V20/Version2017.php create mode 100644 database/migrations/2020_07_20_000000_core_v2017.php diff --git a/app/Abstracts/Commands/Module.php b/app/Abstracts/Commands/Module.php index d995f505e..35f4d49b7 100644 --- a/app/Abstracts/Commands/Module.php +++ b/app/Abstracts/Commands/Module.php @@ -56,7 +56,6 @@ abstract class Module extends Command ModelHistory::create([ 'company_id' => $this->company_id, 'module_id' => $this->model->id, - 'category' => $this->module->get('category'), 'version' => $this->module->get('version'), 'description' => trans('modules.' . $action, ['module' => $this->alias]), ]); diff --git a/app/Console/Stubs/Modules/json.stub b/app/Console/Stubs/Modules/json.stub index ced9ddb44..4f9b5b754 100644 --- a/app/Console/Stubs/Modules/json.stub +++ b/app/Console/Stubs/Modules/json.stub @@ -2,7 +2,6 @@ "alias": "$ALIAS$", "icon": "fa fa-cog", "version": "1.0.0", - "category": "accounting", "active": 1, "providers": [ "$MODULE_NAMESPACE$\\$STUDLY_NAME$\\Providers\\Event", diff --git a/app/Http/Controllers/Install/Updates.php b/app/Http/Controllers/Install/Updates.php index 841a16da6..e4b1cabb0 100644 --- a/app/Http/Controllers/Install/Updates.php +++ b/app/Http/Controllers/Install/Updates.php @@ -39,7 +39,6 @@ class Updates extends Controller $m = new \stdClass(); $m->name = $row->getName(); $m->alias = $row->get('alias'); - $m->category = $row->get('category'); $m->installed = $row->get('version'); $m->latest = $updates[$alias]; diff --git a/app/Http/Controllers/Modules/Item.php b/app/Http/Controllers/Modules/Item.php index 46e8dbc65..9fa93887b 100644 --- a/app/Http/Controllers/Modules/Item.php +++ b/app/Http/Controllers/Modules/Item.php @@ -4,7 +4,6 @@ namespace App\Http\Controllers\Modules; use App\Abstracts\Http\Controller; use App\Models\Module\Module; -use App\Models\Module\ModuleHistory; use App\Traits\Modules; use Illuminate\Http\Request; diff --git a/app/Listeners/Update/CreateModuleUpdatedHistory.php b/app/Listeners/Update/CreateModuleUpdatedHistory.php index 1059630ad..5f28ee7b4 100644 --- a/app/Listeners/Update/CreateModuleUpdatedHistory.php +++ b/app/Listeners/Update/CreateModuleUpdatedHistory.php @@ -33,7 +33,6 @@ class CreateModuleUpdatedHistory ModuleHistory::create([ 'company_id' => $model->company_id, 'module_id' => $model->id, - 'category' => $module->get('category', 'payment-method'), 'version' => $event->new, 'description' => trans('modules.history.updated', ['module' => $module->getAlias()]), ]); diff --git a/app/Listeners/Update/V20/Version2017.php b/app/Listeners/Update/V20/Version2017.php new file mode 100644 index 000000000..b5b9dcf76 --- /dev/null +++ b/app/Listeners/Update/V20/Version2017.php @@ -0,0 +1,29 @@ +skipThisUpdate($event)) { + return; + } + + Artisan::call('migrate', ['--force' => true]); + } +} diff --git a/app/Models/Module/ModuleHistory.php b/app/Models/Module/ModuleHistory.php index c3a61ba76..dbd3376dd 100644 --- a/app/Models/Module/ModuleHistory.php +++ b/app/Models/Module/ModuleHistory.php @@ -6,7 +6,6 @@ use App\Abstracts\Model; class ModuleHistory extends Model { - protected $table = 'module_histories'; /** @@ -14,5 +13,5 @@ class ModuleHistory extends Model * * @var array */ - protected $fillable = ['company_id', 'module_id', 'category', 'version', 'description']; + protected $fillable = ['company_id', 'module_id', 'version', 'description']; } diff --git a/app/Providers/Event.php b/app/Providers/Event.php index 3051a8b4f..52175a0bb 100644 --- a/app/Providers/Event.php +++ b/app/Providers/Event.php @@ -21,6 +21,7 @@ class Event extends Provider 'App\Listeners\Update\V20\Version208', 'App\Listeners\Update\V20\Version209', 'App\Listeners\Update\V20\Version2014', + 'App\Listeners\Update\V20\Version2017', ], 'Illuminate\Auth\Events\Login' => [ 'App\Listeners\Auth\Login', diff --git a/app/Traits/Modules.php b/app/Traits/Modules.php index 1efbd8069..98e0d8529 100644 --- a/app/Traits/Modules.php +++ b/app/Traits/Modules.php @@ -460,7 +460,6 @@ trait Modules { $module = module($alias); $name = $module->getName(); - $category = $module->get('category'); $version = $module->get('version'); $company_id = session('company_id'); @@ -483,7 +482,6 @@ trait Modules 'message' => null, 'data' => [ 'name' => $name, - 'category' => $category, 'version' => $version, ], ]; @@ -513,7 +511,6 @@ trait Modules 'message' => null, 'data' => [ 'name' => $module->getName(), - 'category' => $module->get('category'), 'version' => $module->get('version'), ], ]; @@ -543,7 +540,6 @@ trait Modules 'message' => null, 'data' => [ 'name' => $module->getName(), - 'category' => $module->get('category'), 'version' => $module->get('version'), ], ]; diff --git a/database/migrations/2020_07_20_000000_core_v2017.php b/database/migrations/2020_07_20_000000_core_v2017.php new file mode 100644 index 000000000..48d82fc4c --- /dev/null +++ b/database/migrations/2020_07_20_000000_core_v2017.php @@ -0,0 +1,30 @@ +dropColumn('category'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +} diff --git a/resources/views/install/updates/index.blade.php b/resources/views/install/updates/index.blade.php index 1c08c7872..d43c5c603 100644 --- a/resources/views/install/updates/index.blade.php +++ b/resources/views/install/updates/index.blade.php @@ -46,9 +46,8 @@ {{ trans('general.name') }} - {{ trans_choice('general.categories', 1) }} - {{ trans('updates.installed_version') }} - {{ trans('updates.latest_version') }} + {{ trans('updates.installed_version') }} + {{ trans('updates.latest_version') }} {{ trans('general.actions') }} @@ -57,9 +56,8 @@ @foreach($modules as $module) {{ $module->name }} - {{ $module->category }} - {{ $module->installed }} - {{ $module->latest }} + {{ $module->installed }} + {{ $module->latest }} {{ trans_choice('general.updates', 1) }}