Completed
Push — master ( 91df31...876b8b )
by Sherif
01:12
created
src/Modules/Users/AclUser.php 1 patch
Indentation   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -12,112 +12,112 @@
 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
-    public $fillable = ['profile_picture', 'name', 'email', 'password', 'locale', 'timezone', 'blocked', 'confirmed', 'confirmation_code'];
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
-    public function setProfilePictureAttribute($value) {
68
-        $this->attributes['profile_picture'] = \Media::uploadImageBas64($value, 'users/profile_pictures');
69
-    }
70
-
71
-    /**
72
-     * Return fcm device tokens that will be used in sending fcm notifications.
73
-     *
74
-     * @return array
75
-     */
76
-    public function routeNotificationForFCM()
77
-    {
78
-        $devices = \Core::pushNotificationDevices()->findBy(['user_id' => $this->id]);
79
-        $tokens  = [];
80
-
81
-        foreach ($devices as $device) {
82
-            if (\Core::oauthClients()->accessTokenExpiredOrRevoked($device->access_token)) {
83
-                $device->forceDelete();
84
-                continue;
85
-            }
86
-
87
-            $tokens[] = $device->device_token;
88
-        }
89
-
90
-        return $tokens;
91
-    }
92
-
93
-    /**
94
-     * The channels the user receives notification broadcasts on.
95
-     *
96
-     * @return string
97
-     */
98
-    public function receivesBroadcastNotificationsOn()
99
-    {
100
-        return 'users.'.$this->id;
101
-    }
102
-
103
-    /**
104
-     * Custom password validation.
105
-     *
106
-     * @param  string $password
107
-     * @return boolean
108
-     */
109
-    public function validateForPassportPasswordGrant($password)
110
-    {
111
-        if ($password == config('user.social_pass')) {
112
-            return true;
113
-        }
114
-
115
-        return \Hash::check($password, $this->password);
116
-    }
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
+	public $fillable = ['profile_picture', 'name', 'email', 'password', 'locale', 'timezone', 'blocked', 'confirmed', 'confirmation_code'];
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
+	public function setProfilePictureAttribute($value) {
68
+		$this->attributes['profile_picture'] = \Media::uploadImageBas64($value, 'users/profile_pictures');
69
+	}
70
+
71
+	/**
72
+	 * Return fcm device tokens that will be used in sending fcm notifications.
73
+	 *
74
+	 * @return array
75
+	 */
76
+	public function routeNotificationForFCM()
77
+	{
78
+		$devices = \Core::pushNotificationDevices()->findBy(['user_id' => $this->id]);
79
+		$tokens  = [];
80
+
81
+		foreach ($devices as $device) {
82
+			if (\Core::oauthClients()->accessTokenExpiredOrRevoked($device->access_token)) {
83
+				$device->forceDelete();
84
+				continue;
85
+			}
86
+
87
+			$tokens[] = $device->device_token;
88
+		}
89
+
90
+		return $tokens;
91
+	}
92
+
93
+	/**
94
+	 * The channels the user receives notification broadcasts on.
95
+	 *
96
+	 * @return string
97
+	 */
98
+	public function receivesBroadcastNotificationsOn()
99
+	{
100
+		return 'users.'.$this->id;
101
+	}
102
+
103
+	/**
104
+	 * Custom password validation.
105
+	 *
106
+	 * @param  string $password
107
+	 * @return boolean
108
+	 */
109
+	public function validateForPassportPasswordGrant($password)
110
+	{
111
+		if ($password == config('user.social_pass')) {
112
+			return true;
113
+		}
114
+
115
+		return \Hash::check($password, $this->password);
116
+	}
117 117
     
118
-    public static function boot()
119
-    {
120
-        parent::boot();
121
-        AclUser::observe(AclUserObserver::class);
122
-    }
118
+	public static function boot()
119
+	{
120
+		parent::boot();
121
+		AclUser::observe(AclUserObserver::class);
122
+	}
123 123
 }
Please login to merge, or discard this patch.
src/Modules/Users/Database/Factories/UserFactory.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -7,27 +7,27 @@
 block discarded – undo
7 7
 
8 8
 class UserFactory extends Factory
9 9
 {
10
-    /**
11
-     * The name of the factory's corresponding model.
12
-     *
13
-     * @var string
14
-     */
15
-    protected $model = AclUser::class;
10
+	/**
11
+	 * The name of the factory's corresponding model.
12
+	 *
13
+	 * @var string
14
+	 */
15
+	protected $model = AclUser::class;
16 16
 
17
-    /**
18
-     * Define the model's default state.
19
-     *
20
-     * @return array
21
-     */
22
-    public function definition()
23
-    {
24
-        return [
25
-            'profile_picture' => 'https://picsum.photos/200/300',
26
-            'name'            => $this->faker->name(),
27
-            'email'           => $this->faker->safeEmail(),
28
-            'password'        => 123456,
29
-            'created_at'      => $this->faker->dateTimeBetween('-1 years', 'now'),
30
-            'updated_at'      => $this->faker->dateTimeBetween('-1 years', 'now')
31
-        ];
32
-    }
17
+	/**
18
+	 * Define the model's default state.
19
+	 *
20
+	 * @return array
21
+	 */
22
+	public function definition()
23
+	{
24
+		return [
25
+			'profile_picture' => 'https://picsum.photos/200/300',
26
+			'name'            => $this->faker->name(),
27
+			'email'           => $this->faker->safeEmail(),
28
+			'password'        => 123456,
29
+			'created_at'      => $this->faker->dateTimeBetween('-1 years', 'now'),
30
+			'updated_at'      => $this->faker->dateTimeBetween('-1 years', 'now')
31
+		];
32
+	}
33 33
 }
Please login to merge, or discard this patch.
src/Modules/Permissions/Providers/ModuleServiceProvider.php 2 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -6,29 +6,29 @@
 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
-        if (!$this->app->configurationIsCached()) {
21
-            $this->loadConfigsFrom(module_path('permissions', 'Config', 'app'));
22
-        }
23
-    }
19
+		$this->loadMigrationsFrom(module_path('permissions', 'Database/Migrations', 'app'));
20
+		if (!$this->app->configurationIsCached()) {
21
+			$this->loadConfigsFrom(module_path('permissions', 'Config', 'app'));
22
+		}
23
+	}
24 24
 
25
-    /**
26
-     * Register the module services.
27
-     *
28
-     * @return void
29
-     */
30
-    public function register()
31
-    {
32
-        $this->app->register(RouteServiceProvider::class);
33
-    }
25
+	/**
26
+	 * Register the module services.
27
+	 *
28
+	 * @return void
29
+	 */
30
+	public function register()
31
+	{
32
+		$this->app->register(RouteServiceProvider::class);
33
+	}
34 34
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
         $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'permissions');
18 18
 
19 19
         $this->loadMigrationsFrom(module_path('permissions', 'Database/Migrations', 'app'));
20
-        if (!$this->app->configurationIsCached()) {
20
+        if ( ! $this->app->configurationIsCached()) {
21 21
             $this->loadConfigsFrom(module_path('permissions', 'Config', 'app'));
22 22
         }
23 23
     }
Please login to merge, or discard this patch.
src/Modules/Permissions/Database/Factories/PermissionFactory.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -7,25 +7,25 @@
 block discarded – undo
7 7
 
8 8
 class PermissionFactory extends Factory
9 9
 {
10
-    /**
11
-     * The name of the factory's corresponding model.
12
-     *
13
-     * @var string
14
-     */
15
-    protected $model = Permission::class;
10
+	/**
11
+	 * The name of the factory's corresponding model.
12
+	 *
13
+	 * @var string
14
+	 */
15
+	protected $model = Permission::class;
16 16
 
17
-    /**
18
-     * Define the model's default state.
19
-     *
20
-     * @return array
21
-     */
22
-    public function definition()
23
-    {
24
-        return [
25
-            'name'       => $this->faker->randomElement(['save', 'delete', 'find', 'paginate']),
26
-            'model'      => $this->faker->randomElement(['users', 'roles', 'settings', 'notifications']),
27
-            'created_at' => $this->faker->dateTimeBetween('-1 years', 'now'),
28
-            'updated_at' => $this->faker->dateTimeBetween('-1 years', 'now')
29
-        ];
30
-    }
17
+	/**
18
+	 * Define the model's default state.
19
+	 *
20
+	 * @return array
21
+	 */
22
+	public function definition()
23
+	{
24
+		return [
25
+			'name'       => $this->faker->randomElement(['save', 'delete', 'find', 'paginate']),
26
+			'model'      => $this->faker->randomElement(['users', 'roles', 'settings', 'notifications']),
27
+			'created_at' => $this->faker->dateTimeBetween('-1 years', 'now'),
28
+			'updated_at' => $this->faker->dateTimeBetween('-1 years', 'now')
29
+		];
30
+	}
31 31
 }
Please login to merge, or discard this patch.
src/Modules/Core/Config/core.php 1 patch
Indentation   +73 added lines, -73 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
     | Relations Between Models
8 8
     |--------------------------------------------------------------------------
@@ -11,43 +11,43 @@  discard block
 block discarded – undo
11 11
     |
12 12
     */
13 13
     
14
-    'relations' => [
15
-        'user' => [
16
-            'index' => [],
17
-            'show' => [],
18
-            'account' => [],
19
-        ],
20
-        'permission' => [
21
-            'index' => [],
22
-            'show' => [],
23
-        ],
24
-        'role' => [
25
-            'index' => [],
26
-            'show' => [],
27
-        ],
28
-        'oauthClient' => [
29
-            'index' => [],
30
-            'show' => [],
31
-        ],
32
-        'notification' => [
33
-            'index' => [],
34
-            'unread' => [],
35
-        ],
36
-        'pushNotificationDevice' => [
37
-            'index' => [],
38
-            'show' => [],
39
-        ],
40
-        'report' => [
41
-            'index' => [],
42
-            'show' => [],
43
-        ],
44
-        'setting' => [
45
-            'index' => [],
46
-            'show' => [],
47
-        ],
48
-    ],
14
+	'relations' => [
15
+		'user' => [
16
+			'index' => [],
17
+			'show' => [],
18
+			'account' => [],
19
+		],
20
+		'permission' => [
21
+			'index' => [],
22
+			'show' => [],
23
+		],
24
+		'role' => [
25
+			'index' => [],
26
+			'show' => [],
27
+		],
28
+		'oauthClient' => [
29
+			'index' => [],
30
+			'show' => [],
31
+		],
32
+		'notification' => [
33
+			'index' => [],
34
+			'unread' => [],
35
+		],
36
+		'pushNotificationDevice' => [
37
+			'index' => [],
38
+			'show' => [],
39
+		],
40
+		'report' => [
41
+			'index' => [],
42
+			'show' => [],
43
+		],
44
+		'setting' => [
45
+			'index' => [],
46
+			'show' => [],
47
+		],
48
+	],
49 49
 
50
-    /*
50
+	/*
51 51
     |--------------------------------------------------------------------------
52 52
     | Cache Configurations
53 53
     |--------------------------------------------------------------------------
@@ -56,40 +56,40 @@  discard block
 block discarded – undo
56 56
     |
57 57
     */
58 58
 
59
-    'cache_config' => [
60
-        'oauthClient' => [
61
-            'cache' => [
62
-                'list',
63
-                'find',
64
-                'findBy',
65
-                'paginate',
66
-                'paginateBy',
67
-                'first',
68
-                'deleted'
69
-            ],
70
-            'clear' => [
71
-                'save' => ['oauthClient'],
72
-                'delete' => ['oauthClient'],
73
-                'restore' => ['oauthClient'],
74
-                'revoke' => ['oauthClient'],
75
-                'ubRevoke' => ['oauthClient'],
76
-                'regenerateSecret' => ['oauthClient'],
77
-            ],
78
-        ],
79
-        'setting' => [
80
-            'cache' => [
81
-                'list',
82
-                'find',
83
-                'findBy',
84
-                'paginate',
85
-                'paginateBy',
86
-                'first',
87
-                'deleted'
88
-            ],
89
-            'clear' => [
90
-                'save' => ['setting'],
91
-                'saveMany' => ['setting'],
92
-            ]
93
-        ]
94
-    ]
59
+	'cache_config' => [
60
+		'oauthClient' => [
61
+			'cache' => [
62
+				'list',
63
+				'find',
64
+				'findBy',
65
+				'paginate',
66
+				'paginateBy',
67
+				'first',
68
+				'deleted'
69
+			],
70
+			'clear' => [
71
+				'save' => ['oauthClient'],
72
+				'delete' => ['oauthClient'],
73
+				'restore' => ['oauthClient'],
74
+				'revoke' => ['oauthClient'],
75
+				'ubRevoke' => ['oauthClient'],
76
+				'regenerateSecret' => ['oauthClient'],
77
+			],
78
+		],
79
+		'setting' => [
80
+			'cache' => [
81
+				'list',
82
+				'find',
83
+				'findBy',
84
+				'paginate',
85
+				'paginateBy',
86
+				'first',
87
+				'deleted'
88
+			],
89
+			'clear' => [
90
+				'save' => ['setting'],
91
+				'saveMany' => ['setting'],
92
+			]
93
+		]
94
+	]
95 95
 ];
Please login to merge, or discard this patch.
src/Modules/Core/Providers/ModuleServiceProvider.php 2 patches
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -6,50 +6,50 @@
 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', 'core');
17
-        $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'core');
18
-
19
-        $this->loadMigrationsFrom(module_path('core', 'Database/Migrations', 'app'));
20
-        if (!$this->app->configurationIsCached()) {
21
-            $this->loadConfigsFrom(module_path('core', 'Config', 'app'));
22
-        }
23
-    }
24
-
25
-    /**
26
-     * Register the module services.
27
-     *
28
-     * @return void
29
-     */
30
-    public function register()
31
-    {
32
-        //Bind Core Facade to the Service Container
33
-        $this->app->singleton('Core', function () {
34
-            return new \App\Modules\Core\Core;
35
-        });
36
-
37
-        //Bind Errors Facade to the Service Container
38
-        $this->app->singleton('Errors', function () {
39
-            return new \App\Modules\Core\Errors\Errors;
40
-        });
41
-
42
-        //Bind Media Facade to the Service Container
43
-        $this->app->singleton('Media', function () {
44
-            return new \App\Modules\Core\Utl\Media;
45
-        });
46
-
47
-        //Bind ApiConsumer Facade to the Service Container
48
-        $this->app->singleton('ApiConsumer', function () {
49
-            $app = app();
50
-            return new \App\Modules\Core\Utl\ApiConsumer($app, $app['request'], $app['router']);
51
-        });
9
+	/**
10
+	 * Bootstrap the module services.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function boot()
15
+	{
16
+		$this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'core');
17
+		$this->loadViewsFrom(__DIR__.'/../Resources/Views', 'core');
18
+
19
+		$this->loadMigrationsFrom(module_path('core', 'Database/Migrations', 'app'));
20
+		if (!$this->app->configurationIsCached()) {
21
+			$this->loadConfigsFrom(module_path('core', 'Config', 'app'));
22
+		}
23
+	}
24
+
25
+	/**
26
+	 * Register the module services.
27
+	 *
28
+	 * @return void
29
+	 */
30
+	public function register()
31
+	{
32
+		//Bind Core Facade to the Service Container
33
+		$this->app->singleton('Core', function () {
34
+			return new \App\Modules\Core\Core;
35
+		});
36
+
37
+		//Bind Errors Facade to the Service Container
38
+		$this->app->singleton('Errors', function () {
39
+			return new \App\Modules\Core\Errors\Errors;
40
+		});
41
+
42
+		//Bind Media Facade to the Service Container
43
+		$this->app->singleton('Media', function () {
44
+			return new \App\Modules\Core\Utl\Media;
45
+		});
46
+
47
+		//Bind ApiConsumer Facade to the Service Container
48
+		$this->app->singleton('ApiConsumer', function () {
49
+			$app = app();
50
+			return new \App\Modules\Core\Utl\ApiConsumer($app, $app['request'], $app['router']);
51
+		});
52 52
         
53
-        $this->app->register(RouteServiceProvider::class);
54
-    }
53
+		$this->app->register(RouteServiceProvider::class);
54
+	}
55 55
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
         $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'core');
18 18
 
19 19
         $this->loadMigrationsFrom(module_path('core', 'Database/Migrations', 'app'));
20
-        if (!$this->app->configurationIsCached()) {
20
+        if ( ! $this->app->configurationIsCached()) {
21 21
             $this->loadConfigsFrom(module_path('core', 'Config', 'app'));
22 22
         }
23 23
     }
@@ -30,22 +30,22 @@  discard block
 block discarded – undo
30 30
     public function register()
31 31
     {
32 32
         //Bind Core Facade to the Service Container
33
-        $this->app->singleton('Core', function () {
33
+        $this->app->singleton('Core', function() {
34 34
             return new \App\Modules\Core\Core;
35 35
         });
36 36
 
37 37
         //Bind Errors Facade to the Service Container
38
-        $this->app->singleton('Errors', function () {
38
+        $this->app->singleton('Errors', function() {
39 39
             return new \App\Modules\Core\Errors\Errors;
40 40
         });
41 41
 
42 42
         //Bind Media Facade to the Service Container
43
-        $this->app->singleton('Media', function () {
43
+        $this->app->singleton('Media', function() {
44 44
             return new \App\Modules\Core\Utl\Media;
45 45
         });
46 46
 
47 47
         //Bind ApiConsumer Facade to the Service Container
48
-        $this->app->singleton('ApiConsumer', function () {
48
+        $this->app->singleton('ApiConsumer', function() {
49 49
             $app = app();
50 50
             return new \App\Modules\Core\Utl\ApiConsumer($app, $app['request'], $app['router']);
51 51
         });
Please login to merge, or discard this patch.
src/Modules/Core/Http/Middleware/CheckPermissions.php 2 patches
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -11,68 +11,68 @@
 block discarded – undo
11 11
 
12 12
 class CheckPermissions
13 13
 {
14
-    protected $route;
15
-    protected $auth;
16
-    protected $authMiddleware;
17
-    protected $userService;
18
-    protected $arr;
14
+	protected $route;
15
+	protected $auth;
16
+	protected $authMiddleware;
17
+	protected $userService;
18
+	protected $arr;
19 19
     
20
-    /**
21
-     * Init new object.
22
-     *
23
-     * @param   Route          $route
24
-     * @param   Auth           $auth
25
-     * @param   AuthMiddleware $authMiddleware
26
-     * @param   UserService    $userService
27
-     * @param   Arr            $arr
28
-     *
29
-     * @return  void
30
-     */
31
-    public function __construct(Route $route, Auth $auth, AuthMiddleware $authMiddleware, UserService $userService, Arr $arr)
32
-    {
33
-        $this->route = $route;
34
-        $this->auth = $auth;
35
-        $this->authMiddleware = $authMiddleware;
36
-        $this->userService = $userService;
37
-        $this->arr = $arr;
38
-    }
20
+	/**
21
+	 * Init new object.
22
+	 *
23
+	 * @param   Route          $route
24
+	 * @param   Auth           $auth
25
+	 * @param   AuthMiddleware $authMiddleware
26
+	 * @param   UserService    $userService
27
+	 * @param   Arr            $arr
28
+	 *
29
+	 * @return  void
30
+	 */
31
+	public function __construct(Route $route, Auth $auth, AuthMiddleware $authMiddleware, UserService $userService, Arr $arr)
32
+	{
33
+		$this->route = $route;
34
+		$this->auth = $auth;
35
+		$this->authMiddleware = $authMiddleware;
36
+		$this->userService = $userService;
37
+		$this->arr = $arr;
38
+	}
39 39
 
40
-    /**
41
-     * Handle an incoming request.
42
-     *
43
-     * @param  \Illuminate\Http\Request  $request
44
-     * @param  \Closure  $next
45
-     * @return mixed
46
-     */
47
-    public function handle($request, Closure $next)
48
-    {
49
-        $routeActions        = explode('@', $this->route->currentRouteAction());
50
-        $reflectionClass     = new \ReflectionClass($routeActions[0]);
51
-        $classProperties     = $reflectionClass->getDefaultProperties();
52
-        $skipPermissionCheck = $this->arr->get($classProperties, 'skipPermissionCheck', []);
53
-        $skipLoginCheck      = $this->arr->get($classProperties, 'skipLoginCheck', []);
54
-        $modelName           = explode('\\', $routeActions[0]);
55
-        $modelName           = lcfirst(str_replace('Controller', '', end($modelName)));
56
-        $permission          = $routeActions[1];
40
+	/**
41
+	 * Handle an incoming request.
42
+	 *
43
+	 * @param  \Illuminate\Http\Request  $request
44
+	 * @param  \Closure  $next
45
+	 * @return mixed
46
+	 */
47
+	public function handle($request, Closure $next)
48
+	{
49
+		$routeActions        = explode('@', $this->route->currentRouteAction());
50
+		$reflectionClass     = new \ReflectionClass($routeActions[0]);
51
+		$classProperties     = $reflectionClass->getDefaultProperties();
52
+		$skipPermissionCheck = $this->arr->get($classProperties, 'skipPermissionCheck', []);
53
+		$skipLoginCheck      = $this->arr->get($classProperties, 'skipLoginCheck', []);
54
+		$modelName           = explode('\\', $routeActions[0]);
55
+		$modelName           = lcfirst(str_replace('Controller', '', end($modelName)));
56
+		$permission          = $routeActions[1];
57 57
 
58
-        $this->auth->shouldUse('api');
59
-        if (! in_array($permission, $skipLoginCheck)) {
60
-            $this->authMiddleware->handle($request, function ($request) use ($modelName, $skipPermissionCheck, $permission) {
61
-                $user             = $this->auth->user();
62
-                $isPasswordClient = $user->token() ? $user->token()->client->password_client : false;
58
+		$this->auth->shouldUse('api');
59
+		if (! in_array($permission, $skipLoginCheck)) {
60
+			$this->authMiddleware->handle($request, function ($request) use ($modelName, $skipPermissionCheck, $permission) {
61
+				$user             = $this->auth->user();
62
+				$isPasswordClient = $user->token() ? $user->token()->client->password_client : false;
63 63
     
64
-                if ($user->blocked) {
65
-                    \Errors::userIsBlocked();
66
-                }
64
+				if ($user->blocked) {
65
+					\Errors::userIsBlocked();
66
+				}
67 67
     
68
-                if ($isPasswordClient && (in_array($permission, $skipPermissionCheck) || $this->userService->can($permission, $modelName))) {
69
-                } elseif (! $isPasswordClient && $user->tokenCan($modelName.'-'.$permission)) {
70
-                } else {
71
-                    \Errors::noPermissions();
72
-                }
73
-            });
74
-        }
68
+				if ($isPasswordClient && (in_array($permission, $skipPermissionCheck) || $this->userService->can($permission, $modelName))) {
69
+				} elseif (! $isPasswordClient && $user->tokenCan($modelName.'-'.$permission)) {
70
+				} else {
71
+					\Errors::noPermissions();
72
+				}
73
+			});
74
+		}
75 75
 
76
-        return $next($request);
77
-    }
76
+		return $next($request);
77
+	}
78 78
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
         $permission          = $routeActions[1];
57 57
 
58 58
         $this->auth->shouldUse('api');
59
-        if (! in_array($permission, $skipLoginCheck)) {
60
-            $this->authMiddleware->handle($request, function ($request) use ($modelName, $skipPermissionCheck, $permission) {
59
+        if ( ! in_array($permission, $skipLoginCheck)) {
60
+            $this->authMiddleware->handle($request, function($request) use ($modelName, $skipPermissionCheck, $permission) {
61 61
                 $user             = $this->auth->user();
62 62
                 $isPasswordClient = $user->token() ? $user->token()->client->password_client : false;
63 63
     
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
                 }
67 67
     
68 68
                 if ($isPasswordClient && (in_array($permission, $skipPermissionCheck) || $this->userService->can($permission, $modelName))) {
69
-                } elseif (! $isPasswordClient && $user->tokenCan($modelName.'-'.$permission)) {
69
+                } elseif ( ! $isPasswordClient && $user->tokenCan($modelName.'-'.$permission)) {
70 70
                 } else {
71 71
                     \Errors::noPermissions();
72 72
                 }
Please login to merge, or discard this patch.
src/Modules/Core/BaseClasses/BaseEnum.php 2 patches
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -6,58 +6,58 @@
 block discarded – undo
6 6
 
7 7
 class BaseEnum
8 8
 {
9
-    /**
10
-     * Get all constants as an array.
11
-     *
12
-     * @return  array
13
-     */
14
-    public static function all()
15
-    {
16
-        return (new ReflectionClass(get_called_class()))->getConstants();
17
-    }
18
-
19
-    /**
20
-     * Get all constants values as an array.
21
-     *
22
-     * @return  array
23
-     */
24
-    public static function values()
25
-    {
26
-        return array_values(self::all());
27
-    }
28
-
29
-    /**
30
-     * Get all constants keys as an array.
31
-     *
32
-     * @return  array
33
-     */
34
-    public static function keys()
35
-    {
36
-        return array_keys(self::all());
37
-    }
38
-
39
-    /**
40
-     * Get constant key for the given value.
41
-     *
42
-     * @return  mixed
43
-     */
44
-    public static function key($type)
45
-    {
46
-        return collect(self::all())->search($type);
47
-    }
48
-
49
-    /**
50
-     * Convert the consts to key: value comma seperated string.
51
-     *
52
-     * @return  string
53
-     */
54
-    public static function toString()
55
-    {
56
-        $stringArr = [];
57
-        collect(self::all())->each(function($item, $key) use (&$stringArr) {
58
-            $stringArr[] = $key . ': ' . $item;
59
-        });
60
-
61
-        return implode(',', $stringArr);
62
-    }
9
+	/**
10
+	 * Get all constants as an array.
11
+	 *
12
+	 * @return  array
13
+	 */
14
+	public static function all()
15
+	{
16
+		return (new ReflectionClass(get_called_class()))->getConstants();
17
+	}
18
+
19
+	/**
20
+	 * Get all constants values as an array.
21
+	 *
22
+	 * @return  array
23
+	 */
24
+	public static function values()
25
+	{
26
+		return array_values(self::all());
27
+	}
28
+
29
+	/**
30
+	 * Get all constants keys as an array.
31
+	 *
32
+	 * @return  array
33
+	 */
34
+	public static function keys()
35
+	{
36
+		return array_keys(self::all());
37
+	}
38
+
39
+	/**
40
+	 * Get constant key for the given value.
41
+	 *
42
+	 * @return  mixed
43
+	 */
44
+	public static function key($type)
45
+	{
46
+		return collect(self::all())->search($type);
47
+	}
48
+
49
+	/**
50
+	 * Convert the consts to key: value comma seperated string.
51
+	 *
52
+	 * @return  string
53
+	 */
54
+	public static function toString()
55
+	{
56
+		$stringArr = [];
57
+		collect(self::all())->each(function($item, $key) use (&$stringArr) {
58
+			$stringArr[] = $key . ': ' . $item;
59
+		});
60
+
61
+		return implode(',', $stringArr);
62
+	}
63 63
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
     {
56 56
         $stringArr = [];
57 57
         collect(self::all())->each(function($item, $key) use (&$stringArr) {
58
-            $stringArr[] = $key . ': ' . $item;
58
+            $stringArr[] = $key.': '.$item;
59 59
         });
60 60
 
61 61
         return implode(',', $stringArr);
Please login to merge, or discard this patch.
src/Modules/Core/Database/Factories/SettingFactory.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -7,26 +7,26 @@
 block discarded – undo
7 7
 
8 8
 class SettingFactory extends Factory
9 9
 {
10
-    /**
11
-     * The name of the factory's corresponding model.
12
-     *
13
-     * @var string
14
-     */
15
-    protected $model = Setting::class;
10
+	/**
11
+	 * The name of the factory's corresponding model.
12
+	 *
13
+	 * @var string
14
+	 */
15
+	protected $model = Setting::class;
16 16
 
17
-    /**
18
-     * Define the model's default state.
19
-     *
20
-     * @return array
21
-     */
22
-    public function definition()
23
-    {
24
-        return [
25
-            'name'       => $this->faker->randomElement(['Company Name', 'Title', 'Header Image']),
26
-            'value'      => $this->faker->word(),
27
-            'key'        => $this->faker->word(),
28
-            'created_at' => $this->faker->dateTimeBetween('-1 years', 'now'),
29
-            'updated_at' => $this->faker->dateTimeBetween('-1 years', 'now')
30
-        ];
31
-    }
17
+	/**
18
+	 * Define the model's default state.
19
+	 *
20
+	 * @return array
21
+	 */
22
+	public function definition()
23
+	{
24
+		return [
25
+			'name'       => $this->faker->randomElement(['Company Name', 'Title', 'Header Image']),
26
+			'value'      => $this->faker->word(),
27
+			'key'        => $this->faker->word(),
28
+			'created_at' => $this->faker->dateTimeBetween('-1 years', 'now'),
29
+			'updated_at' => $this->faker->dateTimeBetween('-1 years', 'now')
30
+		];
31
+	}
32 32
 }
Please login to merge, or discard this patch.