-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathInstaller.php
More file actions
41 lines (31 loc) · 950 Bytes
/
Installer.php
File metadata and controls
41 lines (31 loc) · 950 Bytes
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
<?php
declare(strict_types = 1);
namespace Flute\Modules\GiveCore;
use Flute\Core\Database\Entities\Permission;
use Flute\Core\ModulesManager\ModuleInformation;
class Installer extends \Flute\Core\Support\AbstractModuleInstaller
{
public function install(ModuleInformation &$module): bool
{
$permission = Permission::findOne(['name' => 'admin.givecore']);
if (!$permission) {
$permission = new Permission();
$permission->name = 'admin.givecore';
$permission->desc = 'givecore.admin.menu';
$permission->save();
}
return true;
}
public function uninstall(ModuleInformation &$module): bool
{
$permission = Permission::findOne(['name' => 'admin.givecore']);
if ($permission) {
$permission->delete();
}
return true;
}
public function getKey(): ?string
{
return 'GiveCore';
}
}