Completed
Push — master ( ab2185...c08f71 )
by Sherif
01:55
created
src/ApiSkeletonServiceProvider.php 1 patch
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -6,45 +6,45 @@
 block discarded – undo
6 6
 
7 7
 class ApiSkeletonServiceProvider extends ServiceProvider
8 8
 {
9
-    /**
10
-     * Perform post-registration booting of services.
11
-     *
12
-     * @return void
13
-     */
14
-    public function boot()
15
-    {
16
-        $this->publishes([
17
-            __DIR__.'/Modules'                               => app_path('Modules'),
18
-            __DIR__.'/Modules/Core/Resources/Assets'         => base_path('public/doc/assets'),
19
-            __DIR__.'/../lang'                               => base_path('resources/lang'),
20
-            __DIR__.'/../files/Handler.php'                  => app_path('Exceptions/Handler.php'),
21
-            __DIR__.'/../files/AuthServiceProvider.php'      => app_path('Providers/AuthServiceProvider.php'),
22
-            __DIR__.'/../files/BroadcastServiceProvider.php' => app_path('Providers/BroadcastServiceProvider.php'),
23
-            __DIR__.'/../files/Kernel.php'                   => app_path('Console/Kernel.php'),
24
-            __DIR__.'/../files/HttpKernel.php'               => app_path('Http/Kernel.php'),
25
-            __DIR__.'/../files/channels.php'                 => base_path('routes/channels.php'),
26
-            __DIR__.'/../files/phpcs.xml'                    => base_path('/phpcs.xml'),
27
-            __DIR__.'/../files/docker'                       => base_path('/docker'),
28
-            __DIR__.'/../files/docker-compose.dev.yml'       => base_path('/docker-compose.dev.yml'),
29
-            __DIR__.'/../files/docker-compose.prod.yml'      => base_path('/docker-compose.prod.yml'),
30
-            __DIR__.'/../files/.dockerignore'                => base_path('/.dockerignore'),
31
-        ]);
9
+	/**
10
+	 * Perform post-registration booting of services.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function boot()
15
+	{
16
+		$this->publishes([
17
+			__DIR__.'/Modules'                               => app_path('Modules'),
18
+			__DIR__.'/Modules/Core/Resources/Assets'         => base_path('public/doc/assets'),
19
+			__DIR__.'/../lang'                               => base_path('resources/lang'),
20
+			__DIR__.'/../files/Handler.php'                  => app_path('Exceptions/Handler.php'),
21
+			__DIR__.'/../files/AuthServiceProvider.php'      => app_path('Providers/AuthServiceProvider.php'),
22
+			__DIR__.'/../files/BroadcastServiceProvider.php' => app_path('Providers/BroadcastServiceProvider.php'),
23
+			__DIR__.'/../files/Kernel.php'                   => app_path('Console/Kernel.php'),
24
+			__DIR__.'/../files/HttpKernel.php'               => app_path('Http/Kernel.php'),
25
+			__DIR__.'/../files/channels.php'                 => base_path('routes/channels.php'),
26
+			__DIR__.'/../files/phpcs.xml'                    => base_path('/phpcs.xml'),
27
+			__DIR__.'/../files/docker'                       => base_path('/docker'),
28
+			__DIR__.'/../files/docker-compose.dev.yml'       => base_path('/docker-compose.dev.yml'),
29
+			__DIR__.'/../files/docker-compose.prod.yml'      => base_path('/docker-compose.prod.yml'),
30
+			__DIR__.'/../files/.dockerignore'                => base_path('/.dockerignore'),
31
+		]);
32 32
 
33
-        $this->publishes([
34
-            __DIR__.'/../files/auth.php'      => config_path('auth.php'),
35
-        ], 'config');
36
-    }
33
+		$this->publishes([
34
+			__DIR__.'/../files/auth.php'      => config_path('auth.php'),
35
+		], 'config');
36
+	}
37 37
 
38
-    /**
39
-     * Register any package services.
40
-     *
41
-     * @return void
42
-     */
43
-    public function register()
44
-    {
45
-        $this->mergeConfigFrom(
46
-            __DIR__.'/../config/skeleton.php',
47
-            'skeleton'
48
-        );
49
-    }
38
+	/**
39
+	 * Register any package services.
40
+	 *
41
+	 * @return void
42
+	 */
43
+	public function register()
44
+	{
45
+		$this->mergeConfigFrom(
46
+			__DIR__.'/../config/skeleton.php',
47
+			'skeleton'
48
+		);
49
+	}
50 50
 }
Please login to merge, or discard this patch.
src/Modules/Users/Providers/ModuleServiceProvider.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -6,30 +6,30 @@
 block discarded – undo
6 6
 
7 7
 class ModuleServiceProvider extends ServiceProvider
8 8
 {
9
-    /**
10
-     * Bootstrap the module services.
11
-     *
12
-     * @return void
13
-     */
14
-    public function boot()
15
-    {
16
-        $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'users');
17
-        $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'users');
9
+	/**
10
+	 * Bootstrap the module services.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function boot()
15
+	{
16
+		$this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'users');
17
+		$this->loadViewsFrom(__DIR__.'/../Resources/Views', 'users');
18 18
 
19
-        $this->loadMigrationsFrom(module_path('users', 'Database/Migrations', 'app'));
20
-        $this->loadFactoriesFrom(module_path('users', 'Database/Factories', 'app'));
21
-        if(!$this->app->configurationIsCached()) {
22
-            $this->loadConfigsFrom(module_path('users', 'Config', 'app'));
23
-        }
24
-    }
19
+		$this->loadMigrationsFrom(module_path('users', 'Database/Migrations', 'app'));
20
+		$this->loadFactoriesFrom(module_path('users', 'Database/Factories', 'app'));
21
+		if(!$this->app->configurationIsCached()) {
22
+			$this->loadConfigsFrom(module_path('users', 'Config', 'app'));
23
+		}
24
+	}
25 25
 
26
-    /**
27
-     * Register the module services.
28
-     *
29
-     * @return void
30
-     */
31
-    public function register()
32
-    {
33
-        $this->app->register(RouteServiceProvider::class);
34
-    }
26
+	/**
27
+	 * Register the module services.
28
+	 *
29
+	 * @return void
30
+	 */
31
+	public function register()
32
+	{
33
+		$this->app->register(RouteServiceProvider::class);
34
+	}
35 35
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 
19 19
         $this->loadMigrationsFrom(module_path('users', 'Database/Migrations', 'app'));
20 20
         $this->loadFactoriesFrom(module_path('users', 'Database/Factories', 'app'));
21
-        if(!$this->app->configurationIsCached()) {
21
+        if ( ! $this->app->configurationIsCached()) {
22 22
             $this->loadConfigsFrom(module_path('users', 'Config', 'app'));
23 23
         }
24 24
     }
Please login to merge, or discard this patch.
src/Modules/Users/AclUser.php 1 patch
Indentation   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -12,108 +12,108 @@
 block discarded – undo
12 12
 
13 13
 class AclUser extends User
14 14
 {
15
-    use SoftDeletes, HasApiTokens;
16
-    protected $table    = 'users';
17
-    protected $dates    = ['created_at', 'updated_at', 'deleted_at'];
18
-    protected $hidden   = ['password', 'remember_token', 'deleted_at'];
19
-    protected $guarded  = ['id'];
20
-    protected $fillable = ['profile_picture', 'name', 'email', 'password', 'locale', 'timezone'];
21
-
22
-    /**
23
-     * Encrypt the password attribute before
24
-     * saving it in the storage.
25
-     *
26
-     * @param string $value
27
-     */
28
-    public function setPasswordAttribute($value)
29
-    {
30
-        $this->attributes['password'] = \Hash::make($value);
31
-    }
32
-
33
-    /**
34
-     * Get the entity's notifications.
35
-     */
36
-    public function notifications()
37
-    {
38
-        return $this->morphMany(Notification::class, 'notifiable')->orderBy('created_at', 'desc');
39
-    }
40
-
41
-    /**
42
-     * Get the entity's read notifications.
43
-     */
44
-    public function readNotifications()
45
-    {
46
-        return $this->notifications()->whereNotNull('read_at');
47
-    }
48
-
49
-    /**
50
-     * Get the entity's unread notifications.
51
-     */
52
-    public function unreadNotifications()
53
-    {
54
-        return $this->notifications()->whereNull('read_at');
55
-    }
56
-
57
-    public function roles()
58
-    {
59
-        return $this->belongsToMany(Role::class, 'role_user', 'user_id', 'role_id')->whereNull('role_user.deleted_at')->withTimestamps();
60
-    }
61
-
62
-    public function oauthClients()
63
-    {
64
-        return $this->hasMany(OauthClient::class, 'user_id');
65
-    }
66
-
67
-    /**
68
-     * Return fcm device tokens that will be used in sending fcm notifications.
69
-     *
70
-     * @return array
71
-     */
72
-    public function routeNotificationForFCM()
73
-    {
74
-        $devices = \Core::pushNotificationDevices()->findBy(['user_id' => $this->id]);
75
-        $tokens  = [];
76
-
77
-        foreach ($devices as $device) {
78
-            if (\Core::oauthClients()->accessTokenExpiredOrRevoked($device->access_token)) {
79
-                $device->forceDelete();
80
-                continue;
81
-            }
82
-
83
-            $tokens[] = $device->device_token;
84
-        }
85
-
86
-        return $tokens;
87
-    }
88
-
89
-    /**
90
-     * The channels the user receives notification broadcasts on.
91
-     *
92
-     * @return string
93
-     */
94
-    public function receivesBroadcastNotificationsOn()
95
-    {
96
-        return 'users.'.$this->id;
97
-    }
98
-
99
-    /**
100
-     * Custom password validation.
101
-     *
102
-     * @param  string $password
103
-     * @return boolean
104
-     */
105
-    public function validateForPassportPasswordGrant($password)
106
-    {
107
-        if ($password == config('user.social_pass')) {
108
-            return true;
109
-        }
110
-
111
-        return \Hash::check($password, $this->password);
112
-    }
15
+	use SoftDeletes, HasApiTokens;
16
+	protected $table    = 'users';
17
+	protected $dates    = ['created_at', 'updated_at', 'deleted_at'];
18
+	protected $hidden   = ['password', 'remember_token', 'deleted_at'];
19
+	protected $guarded  = ['id'];
20
+	protected $fillable = ['profile_picture', 'name', 'email', 'password', 'locale', 'timezone'];
21
+
22
+	/**
23
+	 * Encrypt the password attribute before
24
+	 * saving it in the storage.
25
+	 *
26
+	 * @param string $value
27
+	 */
28
+	public function setPasswordAttribute($value)
29
+	{
30
+		$this->attributes['password'] = \Hash::make($value);
31
+	}
32
+
33
+	/**
34
+	 * Get the entity's notifications.
35
+	 */
36
+	public function notifications()
37
+	{
38
+		return $this->morphMany(Notification::class, 'notifiable')->orderBy('created_at', 'desc');
39
+	}
40
+
41
+	/**
42
+	 * Get the entity's read notifications.
43
+	 */
44
+	public function readNotifications()
45
+	{
46
+		return $this->notifications()->whereNotNull('read_at');
47
+	}
48
+
49
+	/**
50
+	 * Get the entity's unread notifications.
51
+	 */
52
+	public function unreadNotifications()
53
+	{
54
+		return $this->notifications()->whereNull('read_at');
55
+	}
56
+
57
+	public function roles()
58
+	{
59
+		return $this->belongsToMany(Role::class, 'role_user', 'user_id', 'role_id')->whereNull('role_user.deleted_at')->withTimestamps();
60
+	}
61
+
62
+	public function oauthClients()
63
+	{
64
+		return $this->hasMany(OauthClient::class, 'user_id');
65
+	}
66
+
67
+	/**
68
+	 * Return fcm device tokens that will be used in sending fcm notifications.
69
+	 *
70
+	 * @return array
71
+	 */
72
+	public function routeNotificationForFCM()
73
+	{
74
+		$devices = \Core::pushNotificationDevices()->findBy(['user_id' => $this->id]);
75
+		$tokens  = [];
76
+
77
+		foreach ($devices as $device) {
78
+			if (\Core::oauthClients()->accessTokenExpiredOrRevoked($device->access_token)) {
79
+				$device->forceDelete();
80
+				continue;
81
+			}
82
+
83
+			$tokens[] = $device->device_token;
84
+		}
85
+
86
+		return $tokens;
87
+	}
88
+
89
+	/**
90
+	 * The channels the user receives notification broadcasts on.
91
+	 *
92
+	 * @return string
93
+	 */
94
+	public function receivesBroadcastNotificationsOn()
95
+	{
96
+		return 'users.'.$this->id;
97
+	}
98
+
99
+	/**
100
+	 * Custom password validation.
101
+	 *
102
+	 * @param  string $password
103
+	 * @return boolean
104
+	 */
105
+	public function validateForPassportPasswordGrant($password)
106
+	{
107
+		if ($password == config('user.social_pass')) {
108
+			return true;
109
+		}
110
+
111
+		return \Hash::check($password, $this->password);
112
+	}
113 113
     
114
-    public static function boot()
115
-    {
116
-        parent::boot();
117
-        AclUser::observe(AclUserObserver::class);
118
-    }
114
+	public static function boot()
115
+	{
116
+		parent::boot();
117
+		AclUser::observe(AclUserObserver::class);
118
+	}
119 119
 }
Please login to merge, or discard this patch.
src/Modules/Users/Proxy/LoginProxy.php 1 patch
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -7,64 +7,64 @@
 block discarded – undo
7 7
 
8 8
 class LoginProxy
9 9
 {
10
-    /**
11
-     * Attempt to create an access token using user credentials.
12
-     *
13
-     * @param  string  $email
14
-     * @param  string  $password
15
-     * @return array
16
-     */
17
-    public function login($email, $password)
18
-    {
19
-        return $this->proxy('password', [
20
-            'username' => $email,
21
-            'password' => $password
22
-        ]);
23
-    }
10
+	/**
11
+	 * Attempt to create an access token using user credentials.
12
+	 *
13
+	 * @param  string  $email
14
+	 * @param  string  $password
15
+	 * @return array
16
+	 */
17
+	public function login($email, $password)
18
+	{
19
+		return $this->proxy('password', [
20
+			'username' => $email,
21
+			'password' => $password
22
+		]);
23
+	}
24 24
 
25
-    /**
26
-     * Attempt to refresh the access token using the given refresh token.
27
-     *
28
-     * @param  string $refreshToken
29
-     * @return array
30
-     */
31
-    public function refreshToken($refreshToken)
32
-    {
33
-        return $this->proxy('refresh_token', [
34
-            'refresh_token' => $refreshToken
35
-        ]);
36
-    }
25
+	/**
26
+	 * Attempt to refresh the access token using the given refresh token.
27
+	 *
28
+	 * @param  string $refreshToken
29
+	 * @return array
30
+	 */
31
+	public function refreshToken($refreshToken)
32
+	{
33
+		return $this->proxy('refresh_token', [
34
+			'refresh_token' => $refreshToken
35
+		]);
36
+	}
37 37
 
38
-    /**
39
-     * Proxy a request to the OAuth server.
40
-     *
41
-     * @param string $grantType what type of grant type should be proxied
42
-     * @param array
43
-     */
44
-    public function proxy($grantType, array $data = [])
45
-    {
46
-        $data = array_merge($data, [
47
-            'client_id'     => config('user.passport_client_id'),
48
-            'client_secret' => config('user.passport_client_secret'),
49
-            'grant_type'    => $grantType
50
-        ]);
38
+	/**
39
+	 * Proxy a request to the OAuth server.
40
+	 *
41
+	 * @param string $grantType what type of grant type should be proxied
42
+	 * @param array
43
+	 */
44
+	public function proxy($grantType, array $data = [])
45
+	{
46
+		$data = array_merge($data, [
47
+			'client_id'     => config('user.passport_client_id'),
48
+			'client_secret' => config('user.passport_client_secret'),
49
+			'grant_type'    => $grantType
50
+		]);
51 51
 
52
-        $response = \ApiConsumer::post('/oauth/token', $data);
52
+		$response = \ApiConsumer::post('/oauth/token', $data);
53 53
 
54
-        if (! $response->isSuccessful()) {
55
-            if ($grantType == 'refresh_token') {
56
-                \Errors::invalidRefreshToken();
57
-            }
54
+		if (! $response->isSuccessful()) {
55
+			if ($grantType == 'refresh_token') {
56
+				\Errors::invalidRefreshToken();
57
+			}
58 58
 
59
-            \Errors::loginFailed();
60
-        }
59
+			\Errors::loginFailed();
60
+		}
61 61
 
62
-        $data = json_decode($response->getContent());
62
+		$data = json_decode($response->getContent());
63 63
 
64
-        return [
65
-            'access_token'  => $data->access_token,
66
-            'refresh_token' => $data->refresh_token,
67
-            'expires_in'    => $data->expires_in
68
-        ];
69
-    }
64
+		return [
65
+			'access_token'  => $data->access_token,
66
+			'refresh_token' => $data->refresh_token,
67
+			'expires_in'    => $data->expires_in
68
+		];
69
+	}
70 70
 }
Please login to merge, or discard this patch.
src/Modules/Users/Config/user.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 return [
4 4
 
5
-    /*
5
+	/*
6 6
     |--------------------------------------------------------------------------
7 7
     | Disable Confirm Email
8 8
     |--------------------------------------------------------------------------
@@ -11,9 +11,9 @@  discard block
 block discarded – undo
11 11
     |
12 12
     */
13 13
 
14
-    'disable_confirm_email' => env('DISABLE_CONFIRM_EMAIL', false),
14
+	'disable_confirm_email' => env('DISABLE_CONFIRM_EMAIL', false),
15 15
 
16
-    /*
16
+	/*
17 17
     |--------------------------------------------------------------------------
18 18
     | Confirm Email URL
19 19
     |--------------------------------------------------------------------------
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
     |
23 23
     */
24 24
    
25
-    'confrim_email_url' => env('CONFIRM_EMAIL_URL'),
25
+	'confrim_email_url' => env('CONFIRM_EMAIL_URL'),
26 26
 
27
-    /*
27
+	/*
28 28
     |--------------------------------------------------------------------------
29 29
     | Reset Password URL
30 30
     |--------------------------------------------------------------------------
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
     |
34 34
     */
35 35
    
36
-    'reset_password_url' => env('RESET_PASSWORD_URL'),
36
+	'reset_password_url' => env('RESET_PASSWORD_URL'),
37 37
 
38
-    /*
38
+	/*
39 39
     |--------------------------------------------------------------------------
40 40
     | Passport Client Id
41 41
     |--------------------------------------------------------------------------
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
     |
45 45
     */
46 46
    
47
-    'passport_client_id' => env('PASSWORD_CLIENT_ID'),
47
+	'passport_client_id' => env('PASSWORD_CLIENT_ID'),
48 48
 
49
-    /*
49
+	/*
50 50
     |--------------------------------------------------------------------------
51 51
     | Passport Client Secret
52 52
     |--------------------------------------------------------------------------
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
     |
56 56
     */
57 57
    
58
-    'passport_client_secret' => env('PASSWORD_CLIENT_SECRET'),
58
+	'passport_client_secret' => env('PASSWORD_CLIENT_SECRET'),
59 59
 
60
-    /*
60
+	/*
61 61
     |--------------------------------------------------------------------------
62 62
     | Token Expire In
63 63
     |--------------------------------------------------------------------------
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
     |
67 67
     */
68 68
    
69
-    'token_expire_in' => env('TOKEN_EXPIRE_IN', 10),
69
+	'token_expire_in' => env('TOKEN_EXPIRE_IN', 10),
70 70
 
71
-    /*
71
+	/*
72 72
     |--------------------------------------------------------------------------
73 73
     | Refresh Token Expire In
74 74
     |--------------------------------------------------------------------------
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
     |
78 78
     */
79 79
    
80
-    'refresh_token_expire_in' => env('REFRESH_TOKEN_EXPIRE_IN', 14400),
80
+	'refresh_token_expire_in' => env('REFRESH_TOKEN_EXPIRE_IN', 14400),
81 81
 
82
-    /*
82
+	/*
83 83
     |--------------------------------------------------------------------------
84 84
     | Social Pass
85 85
     |--------------------------------------------------------------------------
@@ -88,5 +88,5 @@  discard block
 block discarded – undo
88 88
     |
89 89
     */
90 90
 
91
-    'social_pass' => env('SOCIAL_PASS', false),
91
+	'social_pass' => env('SOCIAL_PASS', false),
92 92
 ];
Please login to merge, or discard this patch.
src/Modules/Users/Services/UserService.php 2 patches
Indentation   +364 added lines, -364 removed lines patch added patch discarded remove patch
@@ -12,372 +12,372 @@
 block discarded – undo
12 12
 
13 13
 class UserService extends BaseService
14 14
 {
15
-    /**
16
-     * @var PermissionService
17
-     */
18
-    protected $permissionService;
19
-
20
-    /**
21
-     * @var LoginProxy
22
-     */
23
-    protected $loginProxy;
24
-
25
-    /**
26
-     * @var NotificationService
27
-     */
28
-    protected $notificationService;
29
-
30
-    /**
31
-     * @var OauthClientService
32
-     */
33
-    protected $oauthClientService;
34
-
35
-    /**
36
-     * Init new object.
37
-     *
38
-     * @param   UserRepository       $repo
39
-     * @param   PermissionService    $permissionService
40
-     * @param   LoginProxy           $loginProxy
41
-     * @param   NotificationService  $notificationService
42
-     * @param   OauthClientService   $oauthClientService
43
-     * @return  void
44
-     */
45
-    public function __construct(
46
-        UserRepository $repo,
47
-        PermissionService $permissionService,
48
-        LoginProxy $loginProxy,
49
-        NotificationService $notificationService,
50
-        OauthClientService $oauthClientService
51
-    ) {
52
-        $this->permissionService   = $permissionService;
53
-        $this->loginProxy          = $loginProxy;
54
-        $this->notificationService = $notificationService;
55
-        $this->oauthClientService  = $oauthClientService;
56
-        parent::__construct($repo);
57
-    }
58
-
59
-    /**
60
-     * Return the logged in user account.
61
-     *
62
-     * @param  array   $relations
63
-     * @return boolean
64
-     */
65
-    public function account($relations = ['roles.permissions'])
66
-    {
67
-        $permissions = [];
68
-        $user        = $this->repo->find(\Auth::id(), $relations);
69
-        foreach ($user->roles as $role) {
70
-            $role->permissions->each(function ($permission) use (&$permissions) {
71
-                $permissions[$permission->repo][$permission->id] = $permission->name;
72
-            });
73
-        }
74
-        $user->permissions = $permissions;
75
-
76
-        return $user;
77
-    }
78
-
79
-    /**
80
-     * Check if the logged in user or the given user
81
-     * has the given permissions on the given model.
82
-     *
83
-     * @param  string $permissionName
84
-     * @param  string $model
85
-     * @param  mixed  $userId
86
-     * @return boolean
87
-     */
88
-    public function can($permissionName, $model, $userId = false)
89
-    {
90
-        $permission = $this->permissionService->first([
91
-            'and' => [
92
-                'model' => $model,
93
-                'name'  => $permissionName,
94
-                'roles' => [
95
-                    'op' => 'has',
96
-                    'val' => [
97
-                        'users' => [
98
-                            'op' => 'has',
99
-                            'val' => [
100
-                                'users.id' => $userId ?: \Auth::id()
101
-                            ]
102
-                        ]
103
-                    ]
104
-                ]
105
-            ]
106
-        ]);
107
-
108
-        return $permission ? true : false;
109
-    }
110
-
111
-    /**
112
-     * Check if the logged in or the given user has the given role.
113
-     *
114
-     * @param  string[] $roles
115
-     * @param  mixed    $user
116
-     * @return boolean
117
-     */
118
-    public function hasRoles($roles, $user = false)
119
-    {
120
-        return $this->repo->countRoles($user ?: \Auth::id(), $roles) ? true : false;
121
-    }
122
-
123
-    /**
124
-     * Assign the given role ids to the given user.
125
-     *
126
-     * @param  integer $userId
127
-     * @param  array   $roleIds
128
-     * @return object
129
-     */
130
-    public function assignRoles($userId, $roleIds)
131
-    {
132
-        $user = false;
133
-        \DB::transaction(function () use ($userId, $roleIds, &$user) {
134
-            $user = $this->repo->find($userId);
135
-            $this->repo->detachPermissions($userId);
136
-            $this->repo->attachPermissions($userId, $roleIds);
137
-        });
138
-
139
-        return $user;
140
-    }
141
-
142
-    /**
143
-     * Handle the login request to the application.
144
-     *
145
-     * @param  string  $email
146
-     * @param  string  $password
147
-     * @return object
148
-     */
149
-    public function login($email, $password)
150
-    {
151
-        if (! $user = $this->repo->first(['email' => $email])) {
152
-            \Errors::loginFailed();
153
-        } elseif ($user->blocked) {
154
-            \Errors::userIsBlocked();
155
-        } elseif (! config('user.disable_confirm_email') && ! $user->confirmed) {
156
-            \Errors::emailNotConfirmed();
157
-        }
158
-
159
-        return ['user' => $user, 'tokens' => $this->loginProxy->login($user->email, $password)];
160
-    }
161
-
162
-    /**
163
-     * Handle the social login request to the application.
164
-     *
165
-     * @param  string $authCode
166
-     * @param  string $accessToken
167
-     * @return array
168
-     */
169
-    public function loginSocial($authCode, $accessToken, $type)
170
-    {
171
-        $access_token = $authCode ? Arr::get(\Socialite::driver($type)->getAccessTokenResponse($authCode), 'access_token') : $accessToken;
172
-        $user         = \Socialite::driver($type)->userFromToken($access_token);
173
-
174
-        if (! $user->email) {
175
-            \Errors::noSocialEmail();
176
-        }
177
-
178
-        if (! $this->repo->first(['email' => $user->email])) {
179
-            $this->register($user->email, '', true);
180
-        }
181
-
182
-        return $this->loginProxy->login($user->email, config('user.social_pass'));
183
-    }
15
+	/**
16
+	 * @var PermissionService
17
+	 */
18
+	protected $permissionService;
19
+
20
+	/**
21
+	 * @var LoginProxy
22
+	 */
23
+	protected $loginProxy;
24
+
25
+	/**
26
+	 * @var NotificationService
27
+	 */
28
+	protected $notificationService;
29
+
30
+	/**
31
+	 * @var OauthClientService
32
+	 */
33
+	protected $oauthClientService;
34
+
35
+	/**
36
+	 * Init new object.
37
+	 *
38
+	 * @param   UserRepository       $repo
39
+	 * @param   PermissionService    $permissionService
40
+	 * @param   LoginProxy           $loginProxy
41
+	 * @param   NotificationService  $notificationService
42
+	 * @param   OauthClientService   $oauthClientService
43
+	 * @return  void
44
+	 */
45
+	public function __construct(
46
+		UserRepository $repo,
47
+		PermissionService $permissionService,
48
+		LoginProxy $loginProxy,
49
+		NotificationService $notificationService,
50
+		OauthClientService $oauthClientService
51
+	) {
52
+		$this->permissionService   = $permissionService;
53
+		$this->loginProxy          = $loginProxy;
54
+		$this->notificationService = $notificationService;
55
+		$this->oauthClientService  = $oauthClientService;
56
+		parent::__construct($repo);
57
+	}
58
+
59
+	/**
60
+	 * Return the logged in user account.
61
+	 *
62
+	 * @param  array   $relations
63
+	 * @return boolean
64
+	 */
65
+	public function account($relations = ['roles.permissions'])
66
+	{
67
+		$permissions = [];
68
+		$user        = $this->repo->find(\Auth::id(), $relations);
69
+		foreach ($user->roles as $role) {
70
+			$role->permissions->each(function ($permission) use (&$permissions) {
71
+				$permissions[$permission->repo][$permission->id] = $permission->name;
72
+			});
73
+		}
74
+		$user->permissions = $permissions;
75
+
76
+		return $user;
77
+	}
78
+
79
+	/**
80
+	 * Check if the logged in user or the given user
81
+	 * has the given permissions on the given model.
82
+	 *
83
+	 * @param  string $permissionName
84
+	 * @param  string $model
85
+	 * @param  mixed  $userId
86
+	 * @return boolean
87
+	 */
88
+	public function can($permissionName, $model, $userId = false)
89
+	{
90
+		$permission = $this->permissionService->first([
91
+			'and' => [
92
+				'model' => $model,
93
+				'name'  => $permissionName,
94
+				'roles' => [
95
+					'op' => 'has',
96
+					'val' => [
97
+						'users' => [
98
+							'op' => 'has',
99
+							'val' => [
100
+								'users.id' => $userId ?: \Auth::id()
101
+							]
102
+						]
103
+					]
104
+				]
105
+			]
106
+		]);
107
+
108
+		return $permission ? true : false;
109
+	}
110
+
111
+	/**
112
+	 * Check if the logged in or the given user has the given role.
113
+	 *
114
+	 * @param  string[] $roles
115
+	 * @param  mixed    $user
116
+	 * @return boolean
117
+	 */
118
+	public function hasRoles($roles, $user = false)
119
+	{
120
+		return $this->repo->countRoles($user ?: \Auth::id(), $roles) ? true : false;
121
+	}
122
+
123
+	/**
124
+	 * Assign the given role ids to the given user.
125
+	 *
126
+	 * @param  integer $userId
127
+	 * @param  array   $roleIds
128
+	 * @return object
129
+	 */
130
+	public function assignRoles($userId, $roleIds)
131
+	{
132
+		$user = false;
133
+		\DB::transaction(function () use ($userId, $roleIds, &$user) {
134
+			$user = $this->repo->find($userId);
135
+			$this->repo->detachPermissions($userId);
136
+			$this->repo->attachPermissions($userId, $roleIds);
137
+		});
138
+
139
+		return $user;
140
+	}
141
+
142
+	/**
143
+	 * Handle the login request to the application.
144
+	 *
145
+	 * @param  string  $email
146
+	 * @param  string  $password
147
+	 * @return object
148
+	 */
149
+	public function login($email, $password)
150
+	{
151
+		if (! $user = $this->repo->first(['email' => $email])) {
152
+			\Errors::loginFailed();
153
+		} elseif ($user->blocked) {
154
+			\Errors::userIsBlocked();
155
+		} elseif (! config('user.disable_confirm_email') && ! $user->confirmed) {
156
+			\Errors::emailNotConfirmed();
157
+		}
158
+
159
+		return ['user' => $user, 'tokens' => $this->loginProxy->login($user->email, $password)];
160
+	}
161
+
162
+	/**
163
+	 * Handle the social login request to the application.
164
+	 *
165
+	 * @param  string $authCode
166
+	 * @param  string $accessToken
167
+	 * @return array
168
+	 */
169
+	public function loginSocial($authCode, $accessToken, $type)
170
+	{
171
+		$access_token = $authCode ? Arr::get(\Socialite::driver($type)->getAccessTokenResponse($authCode), 'access_token') : $accessToken;
172
+		$user         = \Socialite::driver($type)->userFromToken($access_token);
173
+
174
+		if (! $user->email) {
175
+			\Errors::noSocialEmail();
176
+		}
177
+
178
+		if (! $this->repo->first(['email' => $user->email])) {
179
+			$this->register($user->email, '', true);
180
+		}
181
+
182
+		return $this->loginProxy->login($user->email, config('user.social_pass'));
183
+	}
184 184
     
185
-    /**
186
-     * Handle the registration request.
187
-     *
188
-     * @param  string  $name
189
-     * @param  string  $email
190
-     * @param  string  $password
191
-     * @param  boolean $skipConfirmEmail
192
-     * @return array
193
-     */
194
-    public function register($name, $email, $password, $skipConfirmEmail = false)
195
-    {
196
-        $user = $this->repo->save([
197
-            'name'      => $name,
198
-            'email'     => $email,
199
-            'password'  => $password,
200
-            'confirmed' => $skipConfirmEmail
201
-        ]);
202
-
203
-        if (! $skipConfirmEmail && ! config('user.disable_confirm_email')) {
204
-            $this->sendConfirmationEmail($user->email);
205
-        }
206
-
207
-        return $user;
208
-    }
185
+	/**
186
+	 * Handle the registration request.
187
+	 *
188
+	 * @param  string  $name
189
+	 * @param  string  $email
190
+	 * @param  string  $password
191
+	 * @param  boolean $skipConfirmEmail
192
+	 * @return array
193
+	 */
194
+	public function register($name, $email, $password, $skipConfirmEmail = false)
195
+	{
196
+		$user = $this->repo->save([
197
+			'name'      => $name,
198
+			'email'     => $email,
199
+			'password'  => $password,
200
+			'confirmed' => $skipConfirmEmail
201
+		]);
202
+
203
+		if (! $skipConfirmEmail && ! config('user.disable_confirm_email')) {
204
+			$this->sendConfirmationEmail($user->email);
205
+		}
206
+
207
+		return $user;
208
+	}
209 209
     
210
-    /**
211
-     * Block the user.
212
-     *
213
-     * @param  integer $userId
214
-     * @return object
215
-     */
216
-    public function block($userId)
217
-    {
218
-        if (\Auth::id() == $userId) {
219
-            \Errors::noPermissions();
220
-        }
210
+	/**
211
+	 * Block the user.
212
+	 *
213
+	 * @param  integer $userId
214
+	 * @return object
215
+	 */
216
+	public function block($userId)
217
+	{
218
+		if (\Auth::id() == $userId) {
219
+			\Errors::noPermissions();
220
+		}
221 221
         
222
-        return $this->repo->save(['id' => $userId, 'blocked' => 1]);
223
-    }
224
-
225
-    /**
226
-     * Unblock the user.
227
-     *
228
-     * @param  integer $userId
229
-     * @return object
230
-     */
231
-    public function unblock($userId)
232
-    {
233
-        return $this->repo->save(['id' => $userId, 'blocked' => 0]);
234
-    }
235
-
236
-    /**
237
-     * Send a reset link to the given user.
238
-     *
239
-     * @param  string  $email
240
-     * @return void
241
-     */
242
-    public function sendReset($email)
243
-    {
244
-        if (! $user = $this->repo->first(['email' => $email])) {
245
-            \Errors::notFound('email');
246
-        }
247
-
248
-        $token = \Password::getService()->create($user);
249
-        $this->notificationService->notify($user, 'ResetPassword', $token);
250
-    }
251
-
252
-    /**
253
-     * Reset the given user's password.
254
-     *
255
-     * @param   string  $email
256
-     * @param   string  $password
257
-     * @param   string  $passwordConfirmation
258
-     * @param   string  $token
259
-     * @return string|void
260
-     */
261
-    public function resetPassword($email, $password, $passwordConfirmation, $token)
262
-    {
263
-        $response = \Password::reset([
264
-            'email'                 => $email,
265
-            'password'              => $password,
266
-            'password_confirmation' => $passwordConfirmation,
267
-            'token'                 => $token
268
-        ], function ($user, $password) {
269
-            $this->repo->save(['id' => $user->id, 'password' => $password]);
270
-        });
271
-
272
-        switch ($response) {
273
-            case \Password::PASSWORD_RESET:
274
-                return 'success';
275
-                break;
276
-
277
-            case \Password::INVALID_TOKEN:
278
-                \Errors::invalidResetToken();
279
-                break;
280
-
281
-            case \Password::INVALID_PASSWORD:
282
-                \Errors::invalidResetPassword();
283
-                break;
284
-
285
-            case \Password::INVALID_USER:
286
-                \Errors::notFound('user');
287
-                break;
288
-        }
289
-    }
290
-
291
-    /**
292
-     * Change the logged in user password.
293
-     *
294
-     * @param  string  $password
295
-     * @param  string  $oldPassword
296
-     * @return void
297
-     */
298
-    public function changePassword($password, $oldPassword)
299
-    {
300
-        $user = \Auth::user();
301
-        if (! \Hash::check($oldPassword, $user->password)) {
302
-            \Errors::invalidOldPassword();
303
-        }
304
-
305
-        $this->repo->save(['id' => $user->id, 'password' => $password]);
306
-    }
307
-
308
-    /**
309
-     * Confirm email using the confirmation code.
310
-     *
311
-     * @param  string $confirmationCode
312
-     * @return void
313
-     */
314
-    public function confirmEmail($confirmationCode)
315
-    {
316
-        if (! $user = $this->repo->first(['confirmation_code' => $confirmationCode])) {
317
-            \Errors::invalidConfirmationCode();
318
-        }
319
-
320
-        $this->repo->save(['id' => $user->id, 'confirmed' => 1, 'confirmation_code' => null]);
321
-    }
322
-
323
-    /**
324
-     * Send the confirmation mail.
325
-     *
326
-     * @param  string $email
327
-     * @return void
328
-     */
329
-    public function sendConfirmationEmail($email)
330
-    {
331
-        $user = $this->repo->first(['email' => $email]);
332
-        if ($user->confirmed) {
333
-            \Errors::emailAlreadyConfirmed();
334
-        }
335
-
336
-        $this->repo->save(['id' => $user->id, 'confirmation_code' => sha1(microtime())]);
337
-        $this->notificationService->notify($user, 'ConfirmEmail');
338
-    }
339
-
340
-    /**
341
-     * Save the given data to the logged in user.
342
-     *
343
-     * @param  string $name
344
-     * @param  string $email
345
-     * @param  string $profilePicture
346
-     * @return void
347
-     */
348
-    public function saveProfile($name, $email, $profilePicture = false)
349
-    {
350
-        if ($profilePicture) {
351
-            $data['profile_picture'] = \Media::uploadImageBas64($profilePicture, 'users/profile_pictures');
352
-        }
222
+		return $this->repo->save(['id' => $userId, 'blocked' => 1]);
223
+	}
224
+
225
+	/**
226
+	 * Unblock the user.
227
+	 *
228
+	 * @param  integer $userId
229
+	 * @return object
230
+	 */
231
+	public function unblock($userId)
232
+	{
233
+		return $this->repo->save(['id' => $userId, 'blocked' => 0]);
234
+	}
235
+
236
+	/**
237
+	 * Send a reset link to the given user.
238
+	 *
239
+	 * @param  string  $email
240
+	 * @return void
241
+	 */
242
+	public function sendReset($email)
243
+	{
244
+		if (! $user = $this->repo->first(['email' => $email])) {
245
+			\Errors::notFound('email');
246
+		}
247
+
248
+		$token = \Password::getService()->create($user);
249
+		$this->notificationService->notify($user, 'ResetPassword', $token);
250
+	}
251
+
252
+	/**
253
+	 * Reset the given user's password.
254
+	 *
255
+	 * @param   string  $email
256
+	 * @param   string  $password
257
+	 * @param   string  $passwordConfirmation
258
+	 * @param   string  $token
259
+	 * @return string|void
260
+	 */
261
+	public function resetPassword($email, $password, $passwordConfirmation, $token)
262
+	{
263
+		$response = \Password::reset([
264
+			'email'                 => $email,
265
+			'password'              => $password,
266
+			'password_confirmation' => $passwordConfirmation,
267
+			'token'                 => $token
268
+		], function ($user, $password) {
269
+			$this->repo->save(['id' => $user->id, 'password' => $password]);
270
+		});
271
+
272
+		switch ($response) {
273
+			case \Password::PASSWORD_RESET:
274
+				return 'success';
275
+				break;
276
+
277
+			case \Password::INVALID_TOKEN:
278
+				\Errors::invalidResetToken();
279
+				break;
280
+
281
+			case \Password::INVALID_PASSWORD:
282
+				\Errors::invalidResetPassword();
283
+				break;
284
+
285
+			case \Password::INVALID_USER:
286
+				\Errors::notFound('user');
287
+				break;
288
+		}
289
+	}
290
+
291
+	/**
292
+	 * Change the logged in user password.
293
+	 *
294
+	 * @param  string  $password
295
+	 * @param  string  $oldPassword
296
+	 * @return void
297
+	 */
298
+	public function changePassword($password, $oldPassword)
299
+	{
300
+		$user = \Auth::user();
301
+		if (! \Hash::check($oldPassword, $user->password)) {
302
+			\Errors::invalidOldPassword();
303
+		}
304
+
305
+		$this->repo->save(['id' => $user->id, 'password' => $password]);
306
+	}
307
+
308
+	/**
309
+	 * Confirm email using the confirmation code.
310
+	 *
311
+	 * @param  string $confirmationCode
312
+	 * @return void
313
+	 */
314
+	public function confirmEmail($confirmationCode)
315
+	{
316
+		if (! $user = $this->repo->first(['confirmation_code' => $confirmationCode])) {
317
+			\Errors::invalidConfirmationCode();
318
+		}
319
+
320
+		$this->repo->save(['id' => $user->id, 'confirmed' => 1, 'confirmation_code' => null]);
321
+	}
322
+
323
+	/**
324
+	 * Send the confirmation mail.
325
+	 *
326
+	 * @param  string $email
327
+	 * @return void
328
+	 */
329
+	public function sendConfirmationEmail($email)
330
+	{
331
+		$user = $this->repo->first(['email' => $email]);
332
+		if ($user->confirmed) {
333
+			\Errors::emailAlreadyConfirmed();
334
+		}
335
+
336
+		$this->repo->save(['id' => $user->id, 'confirmation_code' => sha1(microtime())]);
337
+		$this->notificationService->notify($user, 'ConfirmEmail');
338
+	}
339
+
340
+	/**
341
+	 * Save the given data to the logged in user.
342
+	 *
343
+	 * @param  string $name
344
+	 * @param  string $email
345
+	 * @param  string $profilePicture
346
+	 * @return void
347
+	 */
348
+	public function saveProfile($name, $email, $profilePicture = false)
349
+	{
350
+		if ($profilePicture) {
351
+			$data['profile_picture'] = \Media::uploadImageBas64($profilePicture, 'users/profile_pictures');
352
+		}
353 353
         
354
-        $data['id'] = \Auth::id();
355
-        return $this->repo->save([
356
-            'id'             => \Auth::id(),
357
-            'name'           => $name,
358
-            'email'          => $email,
359
-            'profilePicture' => $profilePicture,
360
-        ]);
361
-    }
362
-
363
-    /**
364
-     * Logs out the user, revoke access token and refresh token.
365
-     *
366
-     * @return void
367
-     */
368
-    public function logout()
369
-    {
370
-        $this->oauthClientService->revokeAccessToken(\Auth::user()->token());
371
-    }
372
-
373
-    /**
374
-     * Attempt to refresh the access token using the given refresh token.
375
-     *
376
-     * @param  string $refreshToken
377
-     * @return array
378
-     */
379
-    public function refreshToken($refreshToken)
380
-    {
381
-        return $this->loginProxy->refreshToken($refreshToken);
382
-    }
354
+		$data['id'] = \Auth::id();
355
+		return $this->repo->save([
356
+			'id'             => \Auth::id(),
357
+			'name'           => $name,
358
+			'email'          => $email,
359
+			'profilePicture' => $profilePicture,
360
+		]);
361
+	}
362
+
363
+	/**
364
+	 * Logs out the user, revoke access token and refresh token.
365
+	 *
366
+	 * @return void
367
+	 */
368
+	public function logout()
369
+	{
370
+		$this->oauthClientService->revokeAccessToken(\Auth::user()->token());
371
+	}
372
+
373
+	/**
374
+	 * Attempt to refresh the access token using the given refresh token.
375
+	 *
376
+	 * @param  string $refreshToken
377
+	 * @return array
378
+	 */
379
+	public function refreshToken($refreshToken)
380
+	{
381
+		return $this->loginProxy->refreshToken($refreshToken);
382
+	}
383 383
 }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         $permissions = [];
68 68
         $user        = $this->repo->find(\Auth::id(), $relations);
69 69
         foreach ($user->roles as $role) {
70
-            $role->permissions->each(function ($permission) use (&$permissions) {
70
+            $role->permissions->each(function($permission) use (&$permissions) {
71 71
                 $permissions[$permission->repo][$permission->id] = $permission->name;
72 72
             });
73 73
         }
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     public function assignRoles($userId, $roleIds)
131 131
     {
132 132
         $user = false;
133
-        \DB::transaction(function () use ($userId, $roleIds, &$user) {
133
+        \DB::transaction(function() use ($userId, $roleIds, &$user) {
134 134
             $user = $this->repo->find($userId);
135 135
             $this->repo->detachPermissions($userId);
136 136
             $this->repo->attachPermissions($userId, $roleIds);
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
      */
149 149
     public function login($email, $password)
150 150
     {
151
-        if (! $user = $this->repo->first(['email' => $email])) {
151
+        if ( ! $user = $this->repo->first(['email' => $email])) {
152 152
             \Errors::loginFailed();
153 153
         } elseif ($user->blocked) {
154 154
             \Errors::userIsBlocked();
155
-        } elseif (! config('user.disable_confirm_email') && ! $user->confirmed) {
155
+        } elseif ( ! config('user.disable_confirm_email') && ! $user->confirmed) {
156 156
             \Errors::emailNotConfirmed();
157 157
         }
158 158
 
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
         $access_token = $authCode ? Arr::get(\Socialite::driver($type)->getAccessTokenResponse($authCode), 'access_token') : $accessToken;
172 172
         $user         = \Socialite::driver($type)->userFromToken($access_token);
173 173
 
174
-        if (! $user->email) {
174
+        if ( ! $user->email) {
175 175
             \Errors::noSocialEmail();
176 176
         }
177 177
 
178
-        if (! $this->repo->first(['email' => $user->email])) {
178
+        if ( ! $this->repo->first(['email' => $user->email])) {
179 179
             $this->register($user->email, '', true);
180 180
         }
181 181
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
             'confirmed' => $skipConfirmEmail
201 201
         ]);
202 202
 
203
-        if (! $skipConfirmEmail && ! config('user.disable_confirm_email')) {
203
+        if ( ! $skipConfirmEmail && ! config('user.disable_confirm_email')) {
204 204
             $this->sendConfirmationEmail($user->email);
205 205
         }
206 206
 
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
      */
242 242
     public function sendReset($email)
243 243
     {
244
-        if (! $user = $this->repo->first(['email' => $email])) {
244
+        if ( ! $user = $this->repo->first(['email' => $email])) {
245 245
             \Errors::notFound('email');
246 246
         }
247 247
 
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
             'password'              => $password,
266 266
             'password_confirmation' => $passwordConfirmation,
267 267
             'token'                 => $token
268
-        ], function ($user, $password) {
268
+        ], function($user, $password) {
269 269
             $this->repo->save(['id' => $user->id, 'password' => $password]);
270 270
         });
271 271
 
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
     public function changePassword($password, $oldPassword)
299 299
     {
300 300
         $user = \Auth::user();
301
-        if (! \Hash::check($oldPassword, $user->password)) {
301
+        if ( ! \Hash::check($oldPassword, $user->password)) {
302 302
             \Errors::invalidOldPassword();
303 303
         }
304 304
 
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
      */
314 314
     public function confirmEmail($confirmationCode)
315 315
     {
316
-        if (! $user = $this->repo->first(['confirmation_code' => $confirmationCode])) {
316
+        if ( ! $user = $this->repo->first(['confirmation_code' => $confirmationCode])) {
317 317
             \Errors::invalidConfirmationCode();
318 318
         }
319 319
 
Please login to merge, or discard this patch.
src/Modules/PushNotificationDevices/Providers/ModuleServiceProvider.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -6,30 +6,30 @@
 block discarded – undo
6 6
 
7 7
 class ModuleServiceProvider extends ServiceProvider
8 8
 {
9
-    /**
10
-     * Bootstrap the module services.
11
-     *
12
-     * @return void
13
-     */
14
-    public function boot()
15
-    {
16
-        $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'push-notification-devices');
17
-        $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'push-notification-devices');
9
+	/**
10
+	 * Bootstrap the module services.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function boot()
15
+	{
16
+		$this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'push-notification-devices');
17
+		$this->loadViewsFrom(__DIR__.'/../Resources/Views', 'push-notification-devices');
18 18
 
19
-        $this->loadMigrationsFrom(module_path('push-notification-devices', 'Database/Migrations', 'app'));
20
-        $this->loadFactoriesFrom(module_path('push-notification-devices', 'Database/Factories', 'app'));
21
-        if(!$this->app->configurationIsCached()) {
22
-            $this->loadConfigsFrom(module_path('push-notification-devices', 'Config', 'app'));
23
-        }
24
-    }
19
+		$this->loadMigrationsFrom(module_path('push-notification-devices', 'Database/Migrations', 'app'));
20
+		$this->loadFactoriesFrom(module_path('push-notification-devices', 'Database/Factories', 'app'));
21
+		if(!$this->app->configurationIsCached()) {
22
+			$this->loadConfigsFrom(module_path('push-notification-devices', 'Config', 'app'));
23
+		}
24
+	}
25 25
 
26
-    /**
27
-     * Register the module services.
28
-     *
29
-     * @return void
30
-     */
31
-    public function register()
32
-    {
33
-        $this->app->register(RouteServiceProvider::class);
34
-    }
26
+	/**
27
+	 * Register the module services.
28
+	 *
29
+	 * @return void
30
+	 */
31
+	public function register()
32
+	{
33
+		$this->app->register(RouteServiceProvider::class);
34
+	}
35 35
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 
19 19
         $this->loadMigrationsFrom(module_path('push-notification-devices', 'Database/Migrations', 'app'));
20 20
         $this->loadFactoriesFrom(module_path('push-notification-devices', 'Database/Factories', 'app'));
21
-        if(!$this->app->configurationIsCached()) {
21
+        if ( ! $this->app->configurationIsCached()) {
22 22
             $this->loadConfigsFrom(module_path('push-notification-devices', 'Config', 'app'));
23 23
         }
24 24
     }
Please login to merge, or discard this patch.
src/Modules/Permissions/Providers/ModuleServiceProvider.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -6,30 +6,30 @@
 block discarded – undo
6 6
 
7 7
 class ModuleServiceProvider extends ServiceProvider
8 8
 {
9
-    /**
10
-     * Bootstrap the module services.
11
-     *
12
-     * @return void
13
-     */
14
-    public function boot()
15
-    {
16
-        $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'permissions');
17
-        $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'permissions');
9
+	/**
10
+	 * Bootstrap the module services.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function boot()
15
+	{
16
+		$this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'permissions');
17
+		$this->loadViewsFrom(__DIR__.'/../Resources/Views', 'permissions');
18 18
 
19
-        $this->loadMigrationsFrom(module_path('permissions', 'Database/Migrations', 'app'));
20
-        $this->loadFactoriesFrom(module_path('permissions', 'Database/Factories', 'app'));
21
-        if(!$this->app->configurationIsCached()) {
22
-            $this->loadConfigsFrom(module_path('permissions', 'Config', 'app'));
23
-        }
24
-    }
19
+		$this->loadMigrationsFrom(module_path('permissions', 'Database/Migrations', 'app'));
20
+		$this->loadFactoriesFrom(module_path('permissions', 'Database/Factories', 'app'));
21
+		if(!$this->app->configurationIsCached()) {
22
+			$this->loadConfigsFrom(module_path('permissions', 'Config', 'app'));
23
+		}
24
+	}
25 25
 
26
-    /**
27
-     * Register the module services.
28
-     *
29
-     * @return void
30
-     */
31
-    public function register()
32
-    {
33
-        $this->app->register(RouteServiceProvider::class);
34
-    }
26
+	/**
27
+	 * Register the module services.
28
+	 *
29
+	 * @return void
30
+	 */
31
+	public function register()
32
+	{
33
+		$this->app->register(RouteServiceProvider::class);
34
+	}
35 35
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 
19 19
         $this->loadMigrationsFrom(module_path('permissions', 'Database/Migrations', 'app'));
20 20
         $this->loadFactoriesFrom(module_path('permissions', 'Database/Factories', 'app'));
21
-        if(!$this->app->configurationIsCached()) {
21
+        if ( ! $this->app->configurationIsCached()) {
22 22
             $this->loadConfigsFrom(module_path('permissions', 'Config', 'app'));
23 23
         }
24 24
     }
Please login to merge, or discard this patch.
src/Modules/OauthClients/Providers/ModuleServiceProvider.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -6,30 +6,30 @@
 block discarded – undo
6 6
 
7 7
 class ModuleServiceProvider extends ServiceProvider
8 8
 {
9
-    /**
10
-     * Bootstrap the module services.
11
-     *
12
-     * @return void
13
-     */
14
-    public function boot()
15
-    {
16
-        $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'oauth-clients');
17
-        $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'oauth-clients');
9
+	/**
10
+	 * Bootstrap the module services.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function boot()
15
+	{
16
+		$this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'oauth-clients');
17
+		$this->loadViewsFrom(__DIR__.'/../Resources/Views', 'oauth-clients');
18 18
 
19
-        $this->loadMigrationsFrom(module_path('oauth-clients', 'Database/Migrations', 'app'));
20
-        $this->loadFactoriesFrom(module_path('oauth-clients', 'Database/Factories', 'app'));
21
-        if(!$this->app->configurationIsCached()) {
22
-            $this->loadConfigsFrom(module_path('oauth-clients', 'Config', 'app'));
23
-        }
24
-    }
19
+		$this->loadMigrationsFrom(module_path('oauth-clients', 'Database/Migrations', 'app'));
20
+		$this->loadFactoriesFrom(module_path('oauth-clients', 'Database/Factories', 'app'));
21
+		if(!$this->app->configurationIsCached()) {
22
+			$this->loadConfigsFrom(module_path('oauth-clients', 'Config', 'app'));
23
+		}
24
+	}
25 25
 
26
-    /**
27
-     * Register the module services.
28
-     *
29
-     * @return void
30
-     */
31
-    public function register()
32
-    {
33
-        $this->app->register(RouteServiceProvider::class);
34
-    }
26
+	/**
27
+	 * Register the module services.
28
+	 *
29
+	 * @return void
30
+	 */
31
+	public function register()
32
+	{
33
+		$this->app->register(RouteServiceProvider::class);
34
+	}
35 35
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 
19 19
         $this->loadMigrationsFrom(module_path('oauth-clients', 'Database/Migrations', 'app'));
20 20
         $this->loadFactoriesFrom(module_path('oauth-clients', 'Database/Factories', 'app'));
21
-        if(!$this->app->configurationIsCached()) {
21
+        if ( ! $this->app->configurationIsCached()) {
22 22
             $this->loadConfigsFrom(module_path('oauth-clients', 'Config', 'app'));
23 23
         }
24 24
     }
Please login to merge, or discard this patch.