|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace App\Http\Controllers\Admin; |
|
4
|
|
|
|
|
5
|
|
|
use App\Http\Controllers\BasePageController; |
|
6
|
|
|
use App\Models\Category; |
|
7
|
|
|
use Illuminate\Http\Request; |
|
8
|
|
|
|
|
9
|
|
|
class AdminCategoryController extends BasePageController |
|
10
|
|
|
{ |
|
11
|
|
|
/** |
|
12
|
|
|
* @throws \Exception |
|
13
|
|
|
*/ |
|
14
|
|
|
public function index() |
|
15
|
|
|
{ |
|
16
|
|
|
$this->setAdminPrefs(); |
|
17
|
|
|
$meta_title = $title = 'Category List'; |
|
18
|
|
|
|
|
19
|
|
|
$categorylist = Category::getFlat(); |
|
20
|
|
|
|
|
21
|
|
|
$this->smarty->assign('categorylist', $categorylist); |
|
|
|
|
|
|
22
|
|
|
|
|
23
|
|
|
$content = $this->smarty->fetch('category-list.tpl'); |
|
|
|
|
|
|
24
|
|
|
|
|
25
|
|
|
$this->smarty->assign(compact('title', 'meta_title', 'content')); |
|
26
|
|
|
$this->adminrender(); |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* @param \Illuminate\Http\Request $request |
|
31
|
|
|
* |
|
32
|
|
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector |
|
33
|
|
|
* @throws \Exception |
|
34
|
|
|
*/ |
|
35
|
|
|
public function edit(Request $request) |
|
36
|
|
|
{ |
|
37
|
|
|
$this->setAdminPrefs(); |
|
38
|
|
|
|
|
39
|
|
|
// set the current action |
|
40
|
|
|
$action = $request->input('action') ?? 'view'; |
|
41
|
|
|
|
|
42
|
|
|
switch ($action) { |
|
43
|
|
|
case 'submit': |
|
44
|
|
|
Category::updateCategory( |
|
45
|
|
|
$request->input('id'), |
|
46
|
|
|
$request->input('status'), |
|
47
|
|
|
$request->input('description'), |
|
48
|
|
|
$request->input('disablepreview'), |
|
49
|
|
|
$request->input('minsizetoformrelease'), |
|
50
|
|
|
$request->input('maxsizetoformrelease') |
|
51
|
|
|
); |
|
52
|
|
|
|
|
53
|
|
|
return redirect('admin/category-list'); |
|
54
|
|
|
break; |
|
|
|
|
|
|
55
|
|
|
case 'view': |
|
56
|
|
|
default: |
|
57
|
|
|
if ($request->has('id')) { |
|
58
|
|
|
$this->title = 'Category Edit'; |
|
59
|
|
|
$id = $request->input('id'); |
|
60
|
|
|
$cat = Category::find($id); |
|
61
|
|
|
$this->smarty->assign('category', $cat); |
|
62
|
|
|
} |
|
63
|
|
|
break; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
$this->smarty->assign('status_ids', [Category::STATUS_ACTIVE, Category::STATUS_INACTIVE, Category::STATUS_DISABLED]); |
|
67
|
|
|
$this->smarty->assign('status_names', ['Yes', 'No', 'Disabled']); |
|
68
|
|
|
|
|
69
|
|
|
$content = $this->smarty->fetch('category-edit.tpl'); |
|
70
|
|
|
|
|
71
|
|
|
$this->smarty->assign( |
|
72
|
|
|
[ |
|
73
|
|
|
'content' => $content, |
|
74
|
|
|
'meta_title' => 'View/Edit categories', |
|
75
|
|
|
] |
|
76
|
|
|
); |
|
77
|
|
|
$this->adminrender(); |
|
78
|
|
|
} |
|
79
|
|
|
} |
|
80
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.