Skip to content

Commit abf76cc

Browse files
committed
[Updated: added module status check.]
1 parent a8f84ce commit abf76cc

File tree

4 files changed

+26
-7
lines changed

4 files changed

+26
-7
lines changed

src/Config/system.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
'sort' => 1,
1616
'fields' => [
1717
[
18+
'name' => 'status',
19+
'title' => 'pwa::app.admin.system.status',
20+
'type' => 'boolean'
21+
], [
1822
'name' => 'name',
1923
'title' => 'pwa::app.admin.system.name',
2024
'type' => 'text',

src/Helpers/AdminHelper.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,17 @@ public function __construct(
3232
*/
3333
public function storeCategoryIcon($category)
3434
{
35-
$data = request()->all();
35+
if ( core()->getConfigData('pwa.settings.general.status') ) {
36+
$data = request()->all();
3637

37-
if (! $category instanceof \Webkul\Category\Contracts\Category) {
38-
$category = $this->categoryRepository->findOrFail($category);
39-
}
40-
41-
$category->category_product_in_pwa = ($data['add_in_pwa'] ?? 0) == "1" ? 1 : 0;
42-
$category->save();
38+
if (! $category instanceof \Webkul\Category\Contracts\Category) {
39+
$category = $this->categoryRepository->findOrFail($category);
40+
}
4341

42+
$category->category_product_in_pwa = ($data['add_in_pwa'] ?? 0) == "1" ? 1 : 0;
43+
$category->save();
44+
}
45+
4446
return $category;
4547
}
4648
}

src/Http/Controllers/SinglePageController.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ public function home()
3838
*/
3939
public function index()
4040
{
41+
if (! core()->getConfigData('pwa.settings.general.status') ) {
42+
session()->flash('warning', trans('pwa::app.shop.home.enable-pwa-status'));
43+
44+
return redirect()->route('shop.home.index');
45+
}
46+
4147
$parsedUrl = parse_url(config('app.url'));
4248

4349
$urlPath = isset($parsedUrl['path']) ? $parsedUrl['path'] : '';

src/Resources/lang/en/app.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
'admin' => [
55
'system' => [
66
'pwa' => 'PWA',
7+
'status' => 'Status',
78
'btn-save' => 'Save',
89
'name' => 'Name',
910
'topic' => 'Topic',
@@ -64,5 +65,11 @@
6465
'target-url' => 'Target URL',
6566
'description' => 'Description',
6667
]
68+
],
69+
70+
'shop' => [
71+
'home' => [
72+
'enable-pwa-status' => 'Warning: Please enable pwa extension status from the configuration.',
73+
]
6774
]
6875
];

0 commit comments

Comments
 (0)