Repository navigation
Expand file tree
/
Copy pathCustomModule.php
More file actions
106 lines (94 loc) · 2.4 KB
/
Copy pathCustomModule.php
File metadata and controls
106 lines (94 loc) · 2.4 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?php
namespace Modules\Addons\CustomModule;
use Illuminate\Support\Facades\Artisan;
use Modules\Addons\CustomModule\Support\Installers\CustomModelTableInstaller;
use Components\Modules\Core\AddonModule;
use Components\Modules\Interfaces\ModuleInterface;
/**
* Class CustomModule
* @package Modules\Addons\CustomModule
*/
class CustomModule extends AddonModule implements ModuleInterface
{
/**
* @return string
*/
public function getName()
{
return 'Custom Module';
}
/**
* @return string
*/
public function getSlug()
{
return 'custom-module';
}
/**
* @return string
*/
public function getDescription()
{
return 'Custom Module Description';
}
/**
* @return string
*/
public function getVersion()
{
return '1.0';
}
/**
* @return bool
*/
public function isFree()
{
return true;
}
public function isCustom(): bool
{
return true;
}
/**
* @return string
*/
public function getDocumentation()
{
return 'https://www.easydcim.com/documentation/extensions-integrations/extensions-development/sample-extension/';
}
/**
* Called when the module is activated in the admin panel (Modules → My Modules).
*
* Use this to set up anything the module needs to start working:
* - write default settings to the options table via OptionRepository
* - run module migrations and seed demo data
* - register scheduled tasks
*
* Example:
* app('OptionRepository')->add('custom_module.enabled', true);
*
* @return void
*/
public function onActivate()
{
Artisan::call('migrate', [
'--path' => 'modules/addons/CustomModule/database/migrations',
'--force' => true,
]);
app(CustomModelTableInstaller::class)->install();
}
/**
* Called when the module is deactivated in the admin panel.
*
* Use this to clean up resources the module added:
* - remove settings from the options table
* - drop module-specific database tables (only if safe to discard data)
* - cancel any scheduled tasks registered by this module
*
* Example:
* app('OptionRepository')->delete('custom_module.enabled');
*
* @return void
*/
public function onDeactivate() {}
}