Completed
Push — master ( 4b6f70...bf5864 )
by Sherif
02:04
created
src/Modules/Roles/Repositories/RoleRepository.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -7,39 +7,39 @@
 block discarded – undo
7 7
 
8 8
 class RoleRepository extends BaseRepository
9 9
 {
10
-    /**
11
-     * Init new object.
12
-     *
13
-     * @param   Role $model
14
-     * @return  void
15
-     */
16
-    public function __construct(Role $model)
17
-    {
18
-        parent::__construct($model);
19
-    }
10
+	/**
11
+	 * Init new object.
12
+	 *
13
+	 * @param   Role $model
14
+	 * @return  void
15
+	 */
16
+	public function __construct(Role $model)
17
+	{
18
+		parent::__construct($model);
19
+	}
20 20
 
21
-    /**
22
-     * Detach all permissions from the given role.
23
-     *
24
-     * @param  mixed $role
25
-     * @return object
26
-     */
27
-    public function detachPermissions($role)
28
-    {
29
-        $role = ! filter_var($role, FILTER_VALIDATE_INT) ? $role : $this->find($role);
30
-        $role->permissions()->detach();
31
-    }
21
+	/**
22
+	 * Detach all permissions from the given role.
23
+	 *
24
+	 * @param  mixed $role
25
+	 * @return object
26
+	 */
27
+	public function detachPermissions($role)
28
+	{
29
+		$role = ! filter_var($role, FILTER_VALIDATE_INT) ? $role : $this->find($role);
30
+		$role->permissions()->detach();
31
+	}
32 32
 
33
-    /**
34
-     * Attach permission ids to the given role.
35
-     *
36
-     * @param  mixed $role
37
-     * @param  array $permissionIds
38
-     * @return object
39
-     */
40
-    public function attachPermissions($role, $permissionIds)
41
-    {
42
-        $role = ! filter_var($role, FILTER_VALIDATE_INT) ? $role : $this->find($role);
43
-        $role->permissions()->attach($permissionIds);
44
-    }
33
+	/**
34
+	 * Attach permission ids to the given role.
35
+	 *
36
+	 * @param  mixed $role
37
+	 * @param  array $permissionIds
38
+	 * @return object
39
+	 */
40
+	public function attachPermissions($role, $permissionIds)
41
+	{
42
+		$role = ! filter_var($role, FILTER_VALIDATE_INT) ? $role : $this->find($role);
43
+		$role->permissions()->attach($permissionIds);
44
+	}
45 45
 }
Please login to merge, or discard this patch.
src/Modules/OauthClients/Services/OauthClientService.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
      */
27 27
     public function revoke($clientId)
28 28
     {
29
-        \DB::transaction(function () use ($clientId) {
29
+        \DB::transaction(function() use ($clientId) {
30 30
             $client = $this->repo->find($clientId);
31 31
             $this->repo->revokeClientTokens($client);
32 32
             $this->repo->save(['id'=> $clientId, 'revoked' => true]);
Please login to merge, or discard this patch.
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -7,63 +7,63 @@
 block discarded – undo
7 7
 
8 8
 class OauthClientService extends BaseService
9 9
 {
10
-    /**
11
-     * Init new object.
12
-     *
13
-     * @param   OauthClientRepository $repo
14
-     * @return  void
15
-     */
16
-    public function __construct(OauthClientRepository $repo)
17
-    {
18
-        parent::__construct($repo);
19
-    }
10
+	/**
11
+	 * Init new object.
12
+	 *
13
+	 * @param   OauthClientRepository $repo
14
+	 * @return  void
15
+	 */
16
+	public function __construct(OauthClientRepository $repo)
17
+	{
18
+		parent::__construct($repo);
19
+	}
20 20
 
21
-    /**
22
-     * Revoke the given client.
23
-     *
24
-     * @param  integer  $clientId
25
-     * @return void
26
-     */
27
-    public function revoke($clientId)
28
-    {
29
-        \DB::transaction(function () use ($clientId) {
30
-            $client = $this->repo->find($clientId);
31
-            $this->repo->revokeClientTokens($client);
32
-            $this->repo->save(['id'=> $clientId, 'revoked' => true]);
33
-        });
34
-    }
21
+	/**
22
+	 * Revoke the given client.
23
+	 *
24
+	 * @param  integer  $clientId
25
+	 * @return void
26
+	 */
27
+	public function revoke($clientId)
28
+	{
29
+		\DB::transaction(function () use ($clientId) {
30
+			$client = $this->repo->find($clientId);
31
+			$this->repo->revokeClientTokens($client);
32
+			$this->repo->save(['id'=> $clientId, 'revoked' => true]);
33
+		});
34
+	}
35 35
 
36
-    /**
37
-     * UnRevoke the given client.
38
-     *
39
-     * @param  integer  $clientId
40
-     * @return void
41
-     */
42
-    public function unRevoke($clientId)
43
-    {
44
-        $this->repo->save(['id'=> $clientId, 'revoked' => false]);
45
-    }
36
+	/**
37
+	 * UnRevoke the given client.
38
+	 *
39
+	 * @param  integer  $clientId
40
+	 * @return void
41
+	 */
42
+	public function unRevoke($clientId)
43
+	{
44
+		$this->repo->save(['id'=> $clientId, 'revoked' => false]);
45
+	}
46 46
 
47
-    /**
48
-     * Ensure access token hasn't expired or revoked.
49
-     *
50
-     * @param  string $accessToken
51
-     * @return boolean
52
-     */
53
-    public function accessTokenExpiredOrRevoked($accessToken)
54
-    {
55
-        return $this->repo->accessTokenExpiredOrRevoked($accessToken);
56
-    }
47
+	/**
48
+	 * Ensure access token hasn't expired or revoked.
49
+	 *
50
+	 * @param  string $accessToken
51
+	 * @return boolean
52
+	 */
53
+	public function accessTokenExpiredOrRevoked($accessToken)
54
+	{
55
+		return $this->repo->accessTokenExpiredOrRevoked($accessToken);
56
+	}
57 57
 
58
-    /**
59
-     * Revoke the given access token and all
60
-     * associated refresh tokens.
61
-     *
62
-     * @param  oject $accessToken
63
-     * @return void
64
-     */
65
-    public function revokeAccessToken($accessToken)
66
-    {
67
-        return $this->repo->revokeAccessToken($accessToken);
68
-    }
58
+	/**
59
+	 * Revoke the given access token and all
60
+	 * associated refresh tokens.
61
+	 *
62
+	 * @param  oject $accessToken
63
+	 * @return void
64
+	 */
65
+	public function revokeAccessToken($accessToken)
66
+	{
67
+		return $this->repo->revokeAccessToken($accessToken);
68
+	}
69 69
 }
Please login to merge, or discard this patch.
src/Modules/OauthClients/Repositories/OauthClientRepository.php 1 patch
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -7,64 +7,64 @@
 block discarded – undo
7 7
 
8 8
 class OauthClientRepository extends BaseRepository
9 9
 {
10
-    /**
11
-     * Init new object.
12
-     *
13
-     * @param   OauthClient $model
14
-     * @return  void
15
-     */
16
-    public function __construct(OauthClient $model)
17
-    {
18
-        parent::__construct($model);
19
-    }
10
+	/**
11
+	 * Init new object.
12
+	 *
13
+	 * @param   OauthClient $model
14
+	 * @return  void
15
+	 */
16
+	public function __construct(OauthClient $model)
17
+	{
18
+		parent::__construct($model);
19
+	}
20 20
 
21
-    /**
22
-     * Revoke the given client tokens.
23
-     *
24
-     * @param  mixed  $client
25
-     * @return void
26
-     */
27
-    public function revokeClientTokens($client)
28
-    {
29
-        $client = ! filter_var($client, FILTER_VALIDATE_INT) ? $client : $this->find($client);
30
-        $client->tokens()->update(['revoked' => true]);
31
-    }
21
+	/**
22
+	 * Revoke the given client tokens.
23
+	 *
24
+	 * @param  mixed  $client
25
+	 * @return void
26
+	 */
27
+	public function revokeClientTokens($client)
28
+	{
29
+		$client = ! filter_var($client, FILTER_VALIDATE_INT) ? $client : $this->find($client);
30
+		$client->tokens()->update(['revoked' => true]);
31
+	}
32 32
 
33
-    /**
34
-     * Ensure access token hasn't expired or revoked.
35
-     *
36
-     * @param  string $accessToken
37
-     * @return boolean
38
-     */
39
-    public function accessTokenExpiredOrRevoked($accessToken)
40
-    {
41
-        $accessTokenId = json_decode($accessToken, true)['id'];
42
-        $accessToken   = \DB::table('oauth_access_tokens')
43
-                ->where('id', $accessTokenId)
44
-                ->first();
33
+	/**
34
+	 * Ensure access token hasn't expired or revoked.
35
+	 *
36
+	 * @param  string $accessToken
37
+	 * @return boolean
38
+	 */
39
+	public function accessTokenExpiredOrRevoked($accessToken)
40
+	{
41
+		$accessTokenId = json_decode($accessToken, true)['id'];
42
+		$accessToken   = \DB::table('oauth_access_tokens')
43
+				->where('id', $accessTokenId)
44
+				->first();
45 45
         
46
-        if (\Carbon\Carbon::parse($accessToken->expires_at)->isPast() || $accessToken->revoked) {
47
-            return true;
48
-        }
46
+		if (\Carbon\Carbon::parse($accessToken->expires_at)->isPast() || $accessToken->revoked) {
47
+			return true;
48
+		}
49 49
 
50
-        return false;
51
-    }
50
+		return false;
51
+	}
52 52
 
53
-    /**
54
-     * Revoke the given access token and all
55
-     * associated refresh tokens.
56
-     *
57
-     * @param  oject $accessToken
58
-     * @return void
59
-     */
60
-    public function revokeAccessToken($accessToken)
61
-    {
62
-        \DB::table('oauth_refresh_tokens')
63
-            ->where('access_token_id', $accessToken->id)
64
-            ->update([
65
-                'revoked' => true
66
-            ]);
53
+	/**
54
+	 * Revoke the given access token and all
55
+	 * associated refresh tokens.
56
+	 *
57
+	 * @param  oject $accessToken
58
+	 * @return void
59
+	 */
60
+	public function revokeAccessToken($accessToken)
61
+	{
62
+		\DB::table('oauth_refresh_tokens')
63
+			->where('access_token_id', $accessToken->id)
64
+			->update([
65
+				'revoked' => true
66
+			]);
67 67
 
68
-        $accessToken->revoke();
69
-    }
68
+		$accessToken->revoke();
69
+	}
70 70
 }
Please login to merge, or discard this patch.
src/Modules/Core/Core.php 2 patches
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -6,30 +6,30 @@
 block discarded – undo
6 6
 
7 7
 class Core implements BaseFactoryInterface
8 8
 {
9
-    /**
10
-     * Construct the repository class name based on
11
-     * the method name called, search in the
12
-     * given namespaces for the class and
13
-     * return an instance.
14
-     *
15
-     * @param  string $name the called method name
16
-     * @param  array  $arguments the method arguments
17
-     * @return object
18
-     */
19
-    public function __call($name, $arguments)
20
-    {
21
-        foreach (\Module::all() as $module) {
22
-            $nameSpace = 'App\\Modules\\' . $module['basename'] ;
23
-            $model = ucfirst(\Str::singular($name));
24
-            if(count($arguments) == 1 && $arguments[0]) {
25
-                $class = $nameSpace . '\\Services\\' . $model . 'Service';
26
-            } else {
27
-                $class = $nameSpace . '\\Repositories\\' . $model . 'Repository';
28
-            }
9
+	/**
10
+	 * Construct the repository class name based on
11
+	 * the method name called, search in the
12
+	 * given namespaces for the class and
13
+	 * return an instance.
14
+	 *
15
+	 * @param  string $name the called method name
16
+	 * @param  array  $arguments the method arguments
17
+	 * @return object
18
+	 */
19
+	public function __call($name, $arguments)
20
+	{
21
+		foreach (\Module::all() as $module) {
22
+			$nameSpace = 'App\\Modules\\' . $module['basename'] ;
23
+			$model = ucfirst(\Str::singular($name));
24
+			if(count($arguments) == 1 && $arguments[0]) {
25
+				$class = $nameSpace . '\\Services\\' . $model . 'Service';
26
+			} else {
27
+				$class = $nameSpace . '\\Repositories\\' . $model . 'Repository';
28
+			}
29 29
 
30
-            if (class_exists($class)) {
31
-                return \App::make($class);
32
-            }
33
-        }
34
-    }
30
+			if (class_exists($class)) {
31
+				return \App::make($class);
32
+			}
33
+		}
34
+	}
35 35
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,12 +19,12 @@
 block discarded – undo
19 19
     public function __call($name, $arguments)
20 20
     {
21 21
         foreach (\Module::all() as $module) {
22
-            $nameSpace = 'App\\Modules\\' . $module['basename'] ;
22
+            $nameSpace = 'App\\Modules\\'.$module['basename'];
23 23
             $model = ucfirst(\Str::singular($name));
24
-            if(count($arguments) == 1 && $arguments[0]) {
25
-                $class = $nameSpace . '\\Services\\' . $model . 'Service';
24
+            if (count($arguments) == 1 && $arguments[0]) {
25
+                $class = $nameSpace.'\\Services\\'.$model.'Service';
26 26
             } else {
27
-                $class = $nameSpace . '\\Repositories\\' . $model . 'Repository';
27
+                $class = $nameSpace.'\\Repositories\\'.$model.'Repository';
28 28
             }
29 29
 
30 30
             if (class_exists($class)) {
Please login to merge, or discard this patch.
src/Modules/Core/Traits/Translatable.php 2 patches
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -4,46 +4,46 @@
 block discarded – undo
4 4
 
5 5
 trait Translatable
6 6
 {
7
-    /**
8
-     * Create a new model instance that is existing.
9
-     *
10
-     * @param  array  $attributes
11
-     * @param  string|null  $connection
12
-     * @return static
13
-     */
14
-    public function newFromBuilder($attributes = [], $connection = null)
15
-    {
16
-        $model = parent::newFromBuilder($attributes, $connection);
17
-
18
-        foreach ($model->attributes as $key => $value) {
19
-            if (isset($this->translatable) && in_array($key, $this->translatable)) {
20
-                $model->$key = $this->getTranslatedAttribute($value);
21
-            }
22
-        }
23
-
24
-        return $model;
25
-    }
26
-
27
-    /**
28
-     * Returns a translatable model attribute based on the application's locale settings.
29
-     *
30
-     * @param $values
31
-     * @return string
32
-     */
33
-    protected function getTranslatedAttribute($values)
34
-    {
35
-        $values         = json_decode($values);
36
-        $primaryLocale  = \Session::get('locale');
37
-        $fallbackLocale = 'en';
38
-
39
-        if ($primaryLocale == 'all') {
40
-            return $values;
41
-        }
42
-
43
-        if (! $primaryLocale || ! is_object($values) || ! property_exists($values, $primaryLocale)) {
44
-            return $values ? (isset($values->$fallbackLocale) ? $values->$fallbackLocale : $values) : '';
45
-        }
46
-
47
-        return $primaryLocale == 'all' ? $values : $values->$primaryLocale;
48
-    }
7
+	/**
8
+	 * Create a new model instance that is existing.
9
+	 *
10
+	 * @param  array  $attributes
11
+	 * @param  string|null  $connection
12
+	 * @return static
13
+	 */
14
+	public function newFromBuilder($attributes = [], $connection = null)
15
+	{
16
+		$model = parent::newFromBuilder($attributes, $connection);
17
+
18
+		foreach ($model->attributes as $key => $value) {
19
+			if (isset($this->translatable) && in_array($key, $this->translatable)) {
20
+				$model->$key = $this->getTranslatedAttribute($value);
21
+			}
22
+		}
23
+
24
+		return $model;
25
+	}
26
+
27
+	/**
28
+	 * Returns a translatable model attribute based on the application's locale settings.
29
+	 *
30
+	 * @param $values
31
+	 * @return string
32
+	 */
33
+	protected function getTranslatedAttribute($values)
34
+	{
35
+		$values         = json_decode($values);
36
+		$primaryLocale  = \Session::get('locale');
37
+		$fallbackLocale = 'en';
38
+
39
+		if ($primaryLocale == 'all') {
40
+			return $values;
41
+		}
42
+
43
+		if (! $primaryLocale || ! is_object($values) || ! property_exists($values, $primaryLocale)) {
44
+			return $values ? (isset($values->$fallbackLocale) ? $values->$fallbackLocale : $values) : '';
45
+		}
46
+
47
+		return $primaryLocale == 'all' ? $values : $values->$primaryLocale;
48
+	}
49 49
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
             return $values;
41 41
         }
42 42
 
43
-        if (! $primaryLocale || ! is_object($values) || ! property_exists($values, $primaryLocale)) {
43
+        if ( ! $primaryLocale || ! is_object($values) || ! property_exists($values, $primaryLocale)) {
44 44
             return $values ? (isset($values->$fallbackLocale) ? $values->$fallbackLocale : $values) : '';
45 45
         }
46 46
 
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.
Modules/Core/Console/Commands/Stubs/Module/Repositories/DummyRepository.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -5,14 +5,14 @@
 block discarded – undo
5 5
 
6 6
 class DummyRepository extends BaseRepository
7 7
 {
8
-    /**
9
-     * Init new object.
10
-     *
11
-     * @param   DummyModel $model
12
-     * @return  void
13
-     */
14
-    public function __construct(DummyModel $model)
15
-    {
16
-        parent::__construct($model);
17
-    }
8
+	/**
9
+	 * Init new object.
10
+	 *
11
+	 * @param   DummyModel $model
12
+	 * @return  void
13
+	 */
14
+	public function __construct(DummyModel $model)
15
+	{
16
+		parent::__construct($model);
17
+	}
18 18
 }
Please login to merge, or discard this patch.
src/Modules/Core/Console/Commands/Stubs/Module/Resources/Lang/ar/errors.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@
 block discarded – undo
2 2
 
3 3
 return [
4 4
     
5
-    /**
6
-     * Here goes your error messages.
7
-     */
5
+	/**
6
+	 * Here goes your error messages.
7
+	 */
8 8
 
9 9
 ];
Please login to merge, or discard this patch.
src/Modules/Core/Console/Commands/Stubs/Module/Resources/Lang/en/errors.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@
 block discarded – undo
2 2
 
3 3
 return [
4 4
     
5
-    /**
6
-     * Here goes your error messages.
7
-     */
5
+	/**
6
+	 * Here goes your error messages.
7
+	 */
8 8
 
9 9
 ];
Please login to merge, or discard this patch.