Passed
Push — master ( feb473...abec42 )
by Georgi
02:54
created

DashboardCore::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 0
dl 0
loc 12
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Epesi\Base\Dashboard;
4
5
use Epesi\Core\System\Integration\Modules\ModuleCore;
0 ignored issues
show
Bug introduced by
The type Epesi\Core\System\Integration\Modules\ModuleCore was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Epesi\Base\Dashboard\Integration\DashboardUserSettings;
7
use Epesi\Base\Dashboard\Integration\DashboardSystemSettings;
8
use Epesi\Base\Dashboard\Integration\DashboardNavMenu;
9
use Epesi\Base\User\Database\Models\User;
10
use Epesi\Base\Dashboard\Database\Models\Dashboard;
11
12
class DashboardCore extends ModuleCore
13
{
14
	protected static $alias = 'dashboard';
15
	
16
	protected static $joints = [
17
			DashboardUserSettings::class,
18
			DashboardSystemSettings::class,
19
			DashboardNavMenu::class
20
	];
21
	
22
	public function install()
23
	{
24
		
25
	}
26
	
27
	public function uninstall()
28
	{
29
		
30
	}
31
	
32
	public static function boot()
33
	{
34
		// create user default dashboard
35
		User::created(function(User $user) {
36
			$defaultDashboard = Dashboard::where('user_id', 0)->first();
37
			
38
			$userDefaultDashboard = clone $defaultDashboard;
39
			
40
			$userDefaultDashboard->name = __('Default');
41
			$userDefaultDashboard->user_id = $user->id;
42
			
43
			$userDefaultDashboard->save();
44
		});
45
	}
46
}
47