1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Epesi\Base\Dashboard; |
4
|
|
|
|
5
|
|
|
use Epesi\Core\System\Modules\ModuleCore; |
|
|
|
|
6
|
|
|
use Epesi\Core\System\User\Database\Models\User; |
7
|
|
|
|
8
|
|
|
class DashboardCore extends ModuleCore |
9
|
|
|
{ |
10
|
|
|
protected static $alias = 'dashboard'; |
11
|
|
|
|
12
|
|
|
protected static $joints = [ |
13
|
|
|
Integration\DashboardUserSettings::class, |
14
|
|
|
Integration\DashboardSystemSettings::class, |
15
|
|
|
Integration\DashboardNavMenu::class, |
16
|
|
|
Integration\DashboardHomePage::class |
17
|
|
|
]; |
18
|
|
|
|
19
|
|
|
public function install() |
20
|
|
|
{ |
21
|
|
|
Models\Dashboard::migrate(); |
22
|
|
|
Models\DashboardApplet::migrate(); |
23
|
|
|
|
24
|
|
|
// setup default dashboard |
25
|
|
|
$dashboardId = (int) Models\Dashboard::create()->insert([ |
26
|
|
|
'user_id' => 0, |
27
|
|
|
'name' => __('Admin Default') |
28
|
|
|
]); |
29
|
|
|
|
30
|
|
|
Models\DashboardApplet::create()->insert([ |
31
|
|
|
[ |
32
|
|
|
'dashboard_id' => $dashboardId, |
33
|
|
|
'class' => 'Epesi\\Applets\\Clock\\ClockApplet', |
34
|
|
|
'row' => 0, |
35
|
|
|
'column' => 3, |
36
|
|
|
] |
37
|
|
|
]); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
public static function info() |
41
|
|
|
{ |
42
|
|
|
return [ |
43
|
|
|
__('Author') => 'Georgi Hristov', |
44
|
|
|
__('Copyright') => 'X Systems Ltd', |
45
|
|
|
'', |
46
|
|
|
'Provides dashboard functionality' |
47
|
|
|
]; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
public static function boot() |
51
|
|
|
{ |
52
|
|
|
// create user default dashboard as copy of the system default |
53
|
|
|
User::created(function(User $user) { |
54
|
|
|
if (! $defaultDashboard = Models\Dashboard::create()->addCondition('user_id', 0)->tryLoadAny()) return; |
55
|
|
|
$userDefaultDashboard = (clone $defaultDashboard)->duplicate()->save([ |
56
|
|
|
'name' => __('Default'), |
57
|
|
|
'user_id' => $user->id |
58
|
|
|
]); |
59
|
|
|
|
60
|
|
|
foreach ($defaultDashboard->ref('applets') as $defaultApplet) { |
61
|
|
|
$defaultApplet->duplicate()->saveAndUnload(['dashboard_id' => $userDefaultDashboard->id]); |
62
|
|
|
} |
63
|
|
|
}); |
64
|
|
|
} |
65
|
|
|
} |
66
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths