-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdminController.php
More file actions
79 lines (68 loc) · 1.44 KB
/
AdminController.php
File metadata and controls
79 lines (68 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
/**
* @author : Jakiboy
* @package : FloatPHP Skeleton App
* @version : 1.5.x
* @copyright : (c) 2017 - 2025 Jihad Sinnaour <me@jihadsinnaour.com>
* @link : https://floatphp.com
* @license : MIT
*
* This file if a part of FloatPHP Framework.
*/
declare(strict_types=1);
namespace App\Controllers;
use App\Helpers\inc\Service;
use FloatPHP\Kernel\BackendController;
final class AdminController extends BackendController
{
/**
* @inheritdoc
*/
public function __construct()
{
parent::__construct([
'menu' => Service::i('menu')::get()
]);
}
/**
* adminIndex : [GET] /admin/dashboard/i/
*
* @inheritdoc
*/
public function index() : void
{
$this->render('admin/dashboard/index');
}
/**
* adminUpdate : [POST] /admin/dashboard/i/
*
* @inheritdoc
*/
public function update() : void
{
// ...
}
/**
* configIndex : [GET] /admin/[:name]/c/
*
* @inheritdoc
*/
public function configIndex(string $name) : void
{
$inputs = Service::i('input')->set($name)->get();
$this->render('admin/config/index', ['inputs' => $inputs]);
}
/**
* configUpdate : [POST] /admin/[:name]/c/
*
* @inheritdoc
*/
public function configUpdate(string $name) : void
{
$payload = $this->sanitizeRequest(verify: true, force: true);
if ( Service::i('config')->update($name, $payload) ) {
$this->setResponse('Item updated');
}
$this->setResponse('Unable to update', [], 'warning');
}
}