replace path modules to apps
This commit is contained in:
		| @@ -14,7 +14,7 @@ class ModuleInstall extends Command | ||||
|      * | ||||
|      * @var string | ||||
|      */ | ||||
|     protected $signature = 'module:install {module} {company_id}'; | ||||
|     protected $signature = 'module:install {alias} {company_id}'; | ||||
|  | ||||
|     /** | ||||
|      * The console command description. | ||||
| @@ -32,7 +32,7 @@ class ModuleInstall extends Command | ||||
|     { | ||||
|         $request = [ | ||||
|             'company_id' => $this->argument('company_id'), | ||||
|             'alias' => strtolower($this->argument('module')), | ||||
|             'alias' => strtolower($this->argument('alias')), | ||||
|             'status' => '1', | ||||
|         ]; | ||||
|  | ||||
|   | ||||
| @@ -18,7 +18,7 @@ class Home extends Controller | ||||
|     public function __construct(Route $route) | ||||
|     { | ||||
|         if (!setting('general.api_token')) { | ||||
|             return redirect('modules/token/create')->send(); | ||||
|             return redirect('apps/token/create')->send(); | ||||
|         } | ||||
|  | ||||
|         parent::__construct($route); | ||||
|   | ||||
| @@ -8,6 +8,7 @@ use App\Http\Controllers\Controller; | ||||
| use App\Models\Module\Module; | ||||
| use App\Models\Module\ModuleHistory; | ||||
| use App\Traits\Modules; | ||||
| use Artisan; | ||||
| use Illuminate\Routing\Route; | ||||
|  | ||||
| class Item extends Controller | ||||
| @@ -22,7 +23,7 @@ class Item extends Controller | ||||
|     public function __construct(Route $route) | ||||
|     { | ||||
|         if (!setting('general.api_token')) { | ||||
|             return redirect('modules/token/create')->send(); | ||||
|             return redirect('apps/token/create')->send(); | ||||
|         } | ||||
|  | ||||
|         parent::__construct($route); | ||||
| @@ -73,19 +74,19 @@ class Item extends Controller | ||||
|         // Download | ||||
|         $json['step'][] = array( | ||||
|             'text' => trans('modules.installation.download', ['module' => $name]), | ||||
|             'url'  => url('modules/item/download') | ||||
|             'url'  => url('apps/download') | ||||
|         ); | ||||
|  | ||||
|         // Unzip | ||||
|         $json['step'][] = array( | ||||
|             'text' => trans('modules.installation.unzip', ['module' => $name]), | ||||
|             'url'  => url('modules/item/unzip') | ||||
|             'url'  => url('apps/unzip') | ||||
|         ); | ||||
|  | ||||
|         // Download | ||||
|         $json['step'][] = array( | ||||
|             'text' => trans('modules.installation.install', ['module' => $name]), | ||||
|             'url'  => url('modules/item/install') | ||||
|             'url'  => url('apps/install') | ||||
|         ); | ||||
|  | ||||
|         return response()->json($json); | ||||
| @@ -141,9 +142,9 @@ class Item extends Controller | ||||
|         $json = $this->installModule($path); | ||||
|  | ||||
|         if ($json['success']) { | ||||
|             Artisan::call('module:install ' . $json['data']['alias'] . ' ' . session('company_id')); | ||||
|             Artisan::call('module:install', ['alias' => $json['data']['alias'], 'company_id' => session('company_id')]); | ||||
|  | ||||
|             $message = trans('messages.success.added', ['type' => trans('modules.installed', ['module' => $json['data']['name']])]); | ||||
|             $message = trans('modules.installed', ['module' => $json['data']['name']]); | ||||
|  | ||||
|             flash($message)->success(); | ||||
|         } | ||||
| @@ -162,18 +163,18 @@ class Item extends Controller | ||||
|             'module_id' => $module->id, | ||||
|             'category' => $json['data']['category'], | ||||
|             'version' => $json['data']['version'], | ||||
|             'description' => trans('modules.history.uninstalled', ['module' => $json['data']['name']]), | ||||
|             'description' => trans('modules.uninstalled', ['module' => $json['data']['name']]), | ||||
|         ); | ||||
|  | ||||
|         ModuleHistory::create($data); | ||||
|  | ||||
|         $module->delete(); | ||||
|  | ||||
|         $message = trans('messages.success.added', ['type' => trans('modules.uninstalled', ['module' => $json['data']['name']])]); | ||||
|         $message = trans('modules.uninstalled', ['module' => $json['data']['name']]); | ||||
|  | ||||
|         flash($message)->success(); | ||||
|  | ||||
|         return redirect('modules/item/' . $alias)->send(); | ||||
|         return redirect('apps/' . $alias)->send(); | ||||
|     } | ||||
|  | ||||
|     public function update($alias) | ||||
| @@ -187,16 +188,16 @@ class Item extends Controller | ||||
|             'module_id' => $module->id, | ||||
|             'category' => $json['data']['category'], | ||||
|             'version' => $json['data']['version'], | ||||
|             'description' => trans_choice('modules.history.updated', $json['data']['name']), | ||||
|             'description' => trans_choice('modules.updated', $json['data']['name']), | ||||
|         ); | ||||
|  | ||||
|         ModuleHistory::create($data); | ||||
|  | ||||
|         $message = trans('messages.success.added', ['type' => trans('modules.updated', ['module' => $json['data']['name']])]); | ||||
|         $message = trans('modules.updated', ['module' => $json['data']['name']]); | ||||
|  | ||||
|         flash($message)->success(); | ||||
|  | ||||
|         return redirect('modules/' . $alias)->send(); | ||||
|         return redirect('apps/' . $alias)->send(); | ||||
|     } | ||||
|  | ||||
|     public function enable($alias) | ||||
| @@ -210,7 +211,7 @@ class Item extends Controller | ||||
|             'module_id' => $module->id, | ||||
|             'category' => $json['data']['category'], | ||||
|             'version' => $json['data']['version'], | ||||
|             'description' => trans('modules.history.enabled', ['module' => $json['data']['name']]), | ||||
|             'description' => trans('modules.enabled', ['module' => $json['data']['name']]), | ||||
|         ); | ||||
|  | ||||
|         $module->status = 1; | ||||
| @@ -219,11 +220,11 @@ class Item extends Controller | ||||
|  | ||||
|         ModuleHistory::create($data); | ||||
|  | ||||
|         $message = trans('messages.success.added', ['type' => trans('modules.enabled', ['module' => $json['data']['name']])]); | ||||
|         $message = trans('modules.enabled', ['module' => $json['data']['name']]); | ||||
|  | ||||
|         flash($message)->success(); | ||||
|  | ||||
|         return redirect('modules/' . $alias)->send(); | ||||
|         return redirect('apps/' . $alias)->send(); | ||||
|     } | ||||
|  | ||||
|     public function disable($alias) | ||||
| @@ -237,7 +238,7 @@ class Item extends Controller | ||||
|             'module_id' => $module->id, | ||||
|             'category' => $json['data']['category'], | ||||
|             'version' => $json['data']['version'], | ||||
|             'description' => trans('modules.history.disabled', ['module' => $json['data']['name']]), | ||||
|             'description' => trans('modules.disabled', ['module' => $json['data']['name']]), | ||||
|         ); | ||||
|  | ||||
|         $module->status = 0; | ||||
| @@ -246,10 +247,10 @@ class Item extends Controller | ||||
|  | ||||
|         ModuleHistory::create($data); | ||||
|  | ||||
|         $message = trans('messages.success.added', ['type' => trans('modules.disabled', ['module' => $json['data']['name']])]); | ||||
|         $message = trans('modules.disabled', ['module' => $json['data']['name']]); | ||||
|  | ||||
|         flash($message)->success(); | ||||
|  | ||||
|         return redirect('modules/' . $alias)->send(); | ||||
|         return redirect('apps/' . $alias)->send(); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -18,7 +18,7 @@ class Tiles extends Controller | ||||
|     public function __construct(Route $route) | ||||
|     { | ||||
|         if (!setting('general.api_token')) { | ||||
|             return redirect('modules/token/create')->send(); | ||||
|             return redirect('apps/token/create')->send(); | ||||
|         } | ||||
|  | ||||
|         parent::__construct($route); | ||||
|   | ||||
| @@ -32,6 +32,6 @@ class Token extends Controller | ||||
|  | ||||
|         setting()->save(); | ||||
|  | ||||
|         return redirect('modules/home'); | ||||
|         return redirect('apps/home'); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -56,7 +56,7 @@ class Modules extends Controller | ||||
|  | ||||
|         flash($message)->success(); | ||||
|  | ||||
|         return redirect('settings/modules/' . $alias); | ||||
|         return redirect('settings/apps/' . $alias); | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -157,7 +157,7 @@ class AdminMenu | ||||
|                             continue; | ||||
|                         } | ||||
|  | ||||
|                         $sub->url('settings/modules/' . $module->getAlias(), $module->getName(), $position, $attr); | ||||
|                         $sub->url('settings/apps/' . $module->getAlias(), $module->getName(), $position, $attr); | ||||
|  | ||||
|                         $position++; | ||||
|                     } | ||||
| @@ -170,7 +170,7 @@ class AdminMenu | ||||
|             // Apps | ||||
|             if ($user->can('read-modules-home')) { | ||||
|                 $menu->add([ | ||||
|                     'url' => 'modules/home', | ||||
|                     'url' => 'apps/home', | ||||
|                     'title' => trans_choice('general.modules', 2), | ||||
|                     'icon' => 'fa fa-rocket', | ||||
|                     'order' => 8, | ||||
|   | ||||
| @@ -14,7 +14,7 @@ trait Modules | ||||
|  | ||||
|     public function getModules() | ||||
|     { | ||||
|         $response = $this->getRemote('modules/items'); | ||||
|         $response = $this->getRemote('apps/items'); | ||||
|  | ||||
|         if ($response->getStatusCode() == 200) { | ||||
|             return json_decode($response->getBody())->data; | ||||
| @@ -25,7 +25,7 @@ trait Modules | ||||
|  | ||||
|     public function getModule($alias) | ||||
|     { | ||||
|         $response = $this->getRemote('modules/items/' . $alias); | ||||
|         $response = $this->getRemote('apps/' . $alias); | ||||
|  | ||||
|         if ($response->getStatusCode() == 200) { | ||||
|             return json_decode($response->getBody())->data; | ||||
| @@ -36,7 +36,7 @@ trait Modules | ||||
|  | ||||
|     public function getCategories() | ||||
|     { | ||||
|         $response = $this->getRemote('modules/categories'); | ||||
|         $response = $this->getRemote('apps/categories'); | ||||
|  | ||||
|         if ($response->getStatusCode() == 200) { | ||||
|             return json_decode($response->getBody())->data; | ||||
| @@ -47,7 +47,7 @@ trait Modules | ||||
|  | ||||
|     public function getModulesByCategory($alias) | ||||
|     { | ||||
|         $response = $this->getRemote('modules/categories/' . $alias); | ||||
|         $response = $this->getRemote('apps/categories/' . $alias); | ||||
|  | ||||
|         if ($response->getStatusCode() == 200) { | ||||
|             return json_decode($response->getBody())->data; | ||||
| @@ -58,7 +58,7 @@ trait Modules | ||||
|  | ||||
|     public function getPaidModules() | ||||
|     { | ||||
|         $response = $this->getRemote('modules/paid'); | ||||
|         $response = $this->getRemote('apps/paid'); | ||||
|  | ||||
|         if ($response->getStatusCode() == 200) { | ||||
|             return json_decode($response->getBody())->data; | ||||
| @@ -69,7 +69,7 @@ trait Modules | ||||
|  | ||||
|     public function getNewModules() | ||||
|     { | ||||
|         $response = $this->getRemote('modules/new'); | ||||
|         $response = $this->getRemote('apps/new'); | ||||
|  | ||||
|         if ($response->getStatusCode() == 200) { | ||||
|             return json_decode($response->getBody())->data; | ||||
| @@ -80,7 +80,7 @@ trait Modules | ||||
|  | ||||
|     public function getFreeModules() | ||||
|     { | ||||
|         $response = $this->getRemote('modules/free'); | ||||
|         $response = $this->getRemote('apps/free'); | ||||
|  | ||||
|         if ($response->getStatusCode() == 200) { | ||||
|             return json_decode($response->getBody())->data; | ||||
| @@ -204,8 +204,11 @@ trait Modules | ||||
|         // Update database | ||||
|         Artisan::call('migrate', ['--force' => true]); | ||||
|  | ||||
|         Artisan::call('cache:clear'); | ||||
|  | ||||
|         $data = [ | ||||
|             'path'  => $path, | ||||
|             'name' => $module->name, | ||||
|             'alias' => $module->alias | ||||
|         ]; | ||||
|  | ||||
|   | ||||
| @@ -99,7 +99,7 @@ class Updater | ||||
|         if ($alias == 'core') { | ||||
|             $url = 'core/download/' . $version . '/' . $info['php'] . '/' . $info['mysql']; | ||||
|         } else { | ||||
|             $url = 'modules/items/' . $alias . '/download/' . $version . '/' . $info['akaunting'] . '/' . $info['token']; | ||||
|             $url = 'apps/items/' . $alias . '/download/' . $version . '/' . $info['akaunting'] . '/' . $info['token']; | ||||
|         } | ||||
|  | ||||
|         $response = static::getRemote($url, ['timeout' => 30, 'track_redirects' => true]); | ||||
|   | ||||
| @@ -85,7 +85,7 @@ class Versions | ||||
|             $alias = $module->get('alias'); | ||||
|             $version = $module->get('version'); | ||||
|  | ||||
|             $url = 'modules/items/' . $alias . '/version/' . $version . '/' . $info['akaunting']; | ||||
|             $url = 'apps/items/' . $alias . '/version/' . $version . '/' . $info['akaunting']; | ||||
|  | ||||
|             $data[$alias] = static::getLatestVersion($url); | ||||
|         } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user