Completed
Push — master ( 2f8355...903338 )
by Sherif
03:21
created
src/Modules/V1/Acl/Repositories/UserRepository.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -202,7 +202,7 @@
 block discarded – undo
202 202
      * Reset the given user's password.
203 203
      *
204 204
      * @param  array  $credentials
205
-     * @return integer
205
+     * @return false|null
206 206
      */
207 207
     public function resetPassword($credentials)
208 208
     {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
23 23
      * @param  boolean $user
24 24
      * @return boolean
25 25
      */
26
-    public function can($nameOfPermission, $model, $user = false )
26
+    public function can($nameOfPermission, $model, $user = false)
27 27
     {       
28 28
         $user        = $user ?: \JWTAuth::parseToken()->authenticate();
29 29
         $permissions = [];
30
-        $this->find($user->id, ['groups.permissions'])->groups->lists('permissions')->each(function ($permission) use (&$permissions, $model){
30
+        $this->find($user->id, ['groups.permissions'])->groups->lists('permissions')->each(function($permission) use (&$permissions, $model){
31 31
             $permissions = array_merge($permissions, $permission->where('model', $model)->lists('name')->toArray()); 
32 32
         });
33 33
         
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      */
56 56
     public function assignGroups($user_id, $group_ids)
57 57
     {
58
-        \DB::transaction(function () use ($user_id, $group_ids) {
58
+        \DB::transaction(function() use ($user_id, $group_ids) {
59 59
             $user = $this->find($user_id);
60 60
             $user->groups()->detach();
61 61
             $user->groups()->attach($group_ids);
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
             $view->with(['url' => $url]);
223 223
         });
224 224
 
225
-        $response = \Password::sendResetLink($email, function (\Illuminate\Mail\Message $message) {
225
+        $response = \Password::sendResetLink($email, function(\Illuminate\Mail\Message $message) {
226 226
             $message->subject('Your Password Reset Link');
227 227
         });
228 228
 
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
     public function resetPassword($credentials)
243 243
     {
244 244
         $token    = false;
245
-        $response = \Password::reset($credentials, function ($user, $password) use (&$token) {
245
+        $response = \Password::reset($credentials, function($user, $password) use (&$token) {
246 246
             $user->password = bcrypt($password);
247 247
             $user->save();
248 248
 
Please login to merge, or discard this patch.
Indentation   +223 added lines, -223 removed lines patch added patch discarded remove patch
@@ -4,255 +4,255 @@
 block discarded – undo
4 4
 
5 5
 class UserRepository extends AbstractRepository
6 6
 {
7
-    /**
8
-     * Return the model full namespace.
9
-     * 
10
-     * @return string
11
-     */
12
-    protected function getModel()
13
-    {
14
-        return 'App\Modules\V1\Acl\AclUser';
15
-    }
7
+	/**
8
+	 * Return the model full namespace.
9
+	 * 
10
+	 * @return string
11
+	 */
12
+	protected function getModel()
13
+	{
14
+		return 'App\Modules\V1\Acl\AclUser';
15
+	}
16 16
 
17
-    /**
18
-     * Check if the logged in user or the given user 
19
-     * has the given permissions on the given model.
20
-     * 
21
-     * @param  string  $nameOfPermission
22
-     * @param  string  $model            
23
-     * @param  boolean $user
24
-     * @return boolean
25
-     */
26
-    public function can($nameOfPermission, $model, $user = false )
27
-    {       
28
-        $user        = $user ?: \JWTAuth::parseToken()->authenticate();
29
-        $permissions = [];
30
-        $this->find($user->id, ['groups.permissions'])->groups->lists('permissions')->each(function ($permission) use (&$permissions, $model){
31
-            $permissions = array_merge($permissions, $permission->where('model', $model)->lists('name')->toArray()); 
32
-        });
17
+	/**
18
+	 * Check if the logged in user or the given user 
19
+	 * has the given permissions on the given model.
20
+	 * 
21
+	 * @param  string  $nameOfPermission
22
+	 * @param  string  $model            
23
+	 * @param  boolean $user
24
+	 * @return boolean
25
+	 */
26
+	public function can($nameOfPermission, $model, $user = false )
27
+	{       
28
+		$user        = $user ?: \JWTAuth::parseToken()->authenticate();
29
+		$permissions = [];
30
+		$this->find($user->id, ['groups.permissions'])->groups->lists('permissions')->each(function ($permission) use (&$permissions, $model){
31
+			$permissions = array_merge($permissions, $permission->where('model', $model)->lists('name')->toArray()); 
32
+		});
33 33
         
34
-        return in_array($nameOfPermission, $permissions);
35
-    }
34
+		return in_array($nameOfPermission, $permissions);
35
+	}
36 36
 
37
-    /**
38
-     * Check if the logged in user has the given group.
39
-     * 
40
-     * @param  string  $groupName
41
-     * @return boolean
42
-     */
43
-    public function hasGroup($groupName)
44
-    {
45
-        $groups = $this->find(\JWTAuth::parseToken()->authenticate()->id)->groups;
46
-        return $groups->lists('name')->search($groupName, true) === false ? false : true;
47
-    }
37
+	/**
38
+	 * Check if the logged in user has the given group.
39
+	 * 
40
+	 * @param  string  $groupName
41
+	 * @return boolean
42
+	 */
43
+	public function hasGroup($groupName)
44
+	{
45
+		$groups = $this->find(\JWTAuth::parseToken()->authenticate()->id)->groups;
46
+		return $groups->lists('name')->search($groupName, true) === false ? false : true;
47
+	}
48 48
 
49
-    /**
50
-     * Assign the given group ids to the given user.
51
-     * 
52
-     * @param  integer $user_id    
53
-     * @param  array   $group_ids
54
-     * @return object
55
-     */
56
-    public function assignGroups($user_id, $group_ids)
57
-    {
58
-        \DB::transaction(function () use ($user_id, $group_ids) {
59
-            $user = $this->find($user_id);
60
-            $user->groups()->detach();
61
-            $user->groups()->attach($group_ids);
62
-        });
49
+	/**
50
+	 * Assign the given group ids to the given user.
51
+	 * 
52
+	 * @param  integer $user_id    
53
+	 * @param  array   $group_ids
54
+	 * @return object
55
+	 */
56
+	public function assignGroups($user_id, $group_ids)
57
+	{
58
+		\DB::transaction(function () use ($user_id, $group_ids) {
59
+			$user = $this->find($user_id);
60
+			$user->groups()->detach();
61
+			$user->groups()->attach($group_ids);
62
+		});
63 63
 
64
-        return $this->find($user_id);
65
-    }
64
+		return $this->find($user_id);
65
+	}
66 66
 
67
-    /**
68
-     * Handle a login request to the application.
69
-     * 
70
-     * @param  array   $credentials    
71
-     * @param  boolean $adminLogin
72
-     * @return string
73
-     */
74
-    public function login($credentials, $adminLogin = false)
75
-    {
76
-        if ( ! $user = $this->first(['email' => $credentials['email']])) 
77
-        {
78
-            \ErrorHandler::loginFailed();
79
-        }
80
-        else if ($adminLogin && $user->groups->lists('name')->search('Admin', true) === false) 
81
-        {
82
-            \ErrorHandler::loginFailed();
83
-        }
84
-        else if ( ! $adminLogin && $user->groups->lists('name')->search('Admin', true) !== false) 
85
-        {
86
-            \ErrorHandler::loginFailed();
87
-        }
88
-        else if ($user->blocked)
89
-        {
90
-            \ErrorHandler::userIsBlocked();
91
-        }
92
-        else if ($token = \JWTAuth::attempt($credentials))
93
-        {
94
-            return ['token' => $token];
95
-        }
96
-        else
97
-        {
98
-            \ErrorHandler::loginFailed();
99
-        }
100
-    }
67
+	/**
68
+	 * Handle a login request to the application.
69
+	 * 
70
+	 * @param  array   $credentials    
71
+	 * @param  boolean $adminLogin
72
+	 * @return string
73
+	 */
74
+	public function login($credentials, $adminLogin = false)
75
+	{
76
+		if ( ! $user = $this->first(['email' => $credentials['email']])) 
77
+		{
78
+			\ErrorHandler::loginFailed();
79
+		}
80
+		else if ($adminLogin && $user->groups->lists('name')->search('Admin', true) === false) 
81
+		{
82
+			\ErrorHandler::loginFailed();
83
+		}
84
+		else if ( ! $adminLogin && $user->groups->lists('name')->search('Admin', true) !== false) 
85
+		{
86
+			\ErrorHandler::loginFailed();
87
+		}
88
+		else if ($user->blocked)
89
+		{
90
+			\ErrorHandler::userIsBlocked();
91
+		}
92
+		else if ($token = \JWTAuth::attempt($credentials))
93
+		{
94
+			return ['token' => $token];
95
+		}
96
+		else
97
+		{
98
+			\ErrorHandler::loginFailed();
99
+		}
100
+	}
101 101
 
102
-    /**
103
-     * Handle a social login request of the none admin to the application.
104
-     * 
105
-     * @param  array   $credentials
106
-     * @return string
107
-     */
108
-    public function loginSocial($credentials)
109
-    {
110
-        $user = \Socialite::driver($credentials['type'])->userFromToken($credentials['access_token']);
102
+	/**
103
+	 * Handle a social login request of the none admin to the application.
104
+	 * 
105
+	 * @param  array   $credentials
106
+	 * @return string
107
+	 */
108
+	public function loginSocial($credentials)
109
+	{
110
+		$user = \Socialite::driver($credentials['type'])->userFromToken($credentials['access_token']);
111 111
 
112
-        if ( ! $user->email)
113
-        {
114
-            \ErrorHandler::noSocialEmail();
115
-        }
112
+		if ( ! $user->email)
113
+		{
114
+			\ErrorHandler::noSocialEmail();
115
+		}
116 116
 
117
-        if ( ! $registeredUser = $this->model->where('email', $user->email)->first()) 
118
-        {
119
-            $data = ['email' => $user->email, 'password' => ''];
120
-            return $this->register($data);
121
-        }
122
-        else
123
-        {
124
-            return $this->login(['email' => $registeredUser->email, 'password' => ''], false);
125
-        }
126
-    }
117
+		if ( ! $registeredUser = $this->model->where('email', $user->email)->first()) 
118
+		{
119
+			$data = ['email' => $user->email, 'password' => ''];
120
+			return $this->register($data);
121
+		}
122
+		else
123
+		{
124
+			return $this->login(['email' => $registeredUser->email, 'password' => ''], false);
125
+		}
126
+	}
127 127
     
128
-    /**
129
-     * Handle a registration request.
130
-     * 
131
-     * @param  array $credentials
132
-     * @return string
133
-     */
134
-    public function register($credentials)
135
-    {
136
-        return ['token' => \JWTAuth::fromUser($this->model->create($credentials))];
137
-    }
128
+	/**
129
+	 * Handle a registration request.
130
+	 * 
131
+	 * @param  array $credentials
132
+	 * @return string
133
+	 */
134
+	public function register($credentials)
135
+	{
136
+		return ['token' => \JWTAuth::fromUser($this->model->create($credentials))];
137
+	}
138 138
 
139
-    /**
140
-     * Logout the user.
141
-     * 
142
-     * @return boolean
143
-     */
144
-    public function logout()
145
-    {
146
-        return \JWTAuth::invalidate(\JWTAuth::getToken());
147
-    }
139
+	/**
140
+	 * Logout the user.
141
+	 * 
142
+	 * @return boolean
143
+	 */
144
+	public function logout()
145
+	{
146
+		return \JWTAuth::invalidate(\JWTAuth::getToken());
147
+	}
148 148
 
149
-    /**
150
-     * Block the user.
151
-     *
152
-     * @param  integer $user_id
153
-     * @return object
154
-     */
155
-    public function block($user_id)
156
-    {
157
-        if ( ! $user = $this->find($user_id)) 
158
-        {
159
-            \ErrorHandler::notFound('user');
160
-        }
161
-        if ( ! $this->hasGroup('Admin'))
162
-        {
163
-            \ErrorHandler::noPermissions();
164
-        }
165
-        else if (\JWTAuth::parseToken()->authenticate()->id == $user_id)
166
-        {
167
-            \ErrorHandler::noPermissions();
168
-        }
169
-        else if ($user->groups->lists('name')->search('Admin', true) !== false) 
170
-        {
171
-            \ErrorHandler::noPermissions();
172
-        }
149
+	/**
150
+	 * Block the user.
151
+	 *
152
+	 * @param  integer $user_id
153
+	 * @return object
154
+	 */
155
+	public function block($user_id)
156
+	{
157
+		if ( ! $user = $this->find($user_id)) 
158
+		{
159
+			\ErrorHandler::notFound('user');
160
+		}
161
+		if ( ! $this->hasGroup('Admin'))
162
+		{
163
+			\ErrorHandler::noPermissions();
164
+		}
165
+		else if (\JWTAuth::parseToken()->authenticate()->id == $user_id)
166
+		{
167
+			\ErrorHandler::noPermissions();
168
+		}
169
+		else if ($user->groups->lists('name')->search('Admin', true) !== false) 
170
+		{
171
+			\ErrorHandler::noPermissions();
172
+		}
173 173
 
174
-        $user->blocked = 1;
175
-        $user->save();
174
+		$user->blocked = 1;
175
+		$user->save();
176 176
         
177
-        return $user;
178
-    }
177
+		return $user;
178
+	}
179 179
 
180
-    /**
181
-     * Unblock the user.
182
-     *
183
-     * @param  integer $user_id
184
-     * @return object
185
-     */
186
-    public function unblock($user_id)
187
-    {
188
-        if ( ! $this->hasGroup('Admin'))
189
-        {
190
-            \ErrorHandler::noPermissions();
191
-        }
180
+	/**
181
+	 * Unblock the user.
182
+	 *
183
+	 * @param  integer $user_id
184
+	 * @return object
185
+	 */
186
+	public function unblock($user_id)
187
+	{
188
+		if ( ! $this->hasGroup('Admin'))
189
+		{
190
+			\ErrorHandler::noPermissions();
191
+		}
192 192
 
193
-        $user          = $this->find($user_id);
194
-        $user->blocked = 0;
195
-        $user->save();
193
+		$user          = $this->find($user_id);
194
+		$user->blocked = 0;
195
+		$user->save();
196 196
 
197
-        return $user;
198
-    }
197
+		return $user;
198
+	}
199 199
 
200
-    /**
201
-     * Send a reset link to the given user.
202
-     *
203
-     * @param  string  $url
204
-     * @param  string  $email
205
-     * @return void
206
-     */
207
-    public function sendReset($email, $url)
208
-    {
209
-        view()->composer('auth.emails.password', function($view) use ($url) {
210
-            $view->with(['url' => $url]);
211
-        });
200
+	/**
201
+	 * Send a reset link to the given user.
202
+	 *
203
+	 * @param  string  $url
204
+	 * @param  string  $email
205
+	 * @return void
206
+	 */
207
+	public function sendReset($email, $url)
208
+	{
209
+		view()->composer('auth.emails.password', function($view) use ($url) {
210
+			$view->with(['url' => $url]);
211
+		});
212 212
 
213
-        $response = \Password::sendResetLink($email, function (\Illuminate\Mail\Message $message) {
214
-            $message->subject('Your Password Reset Link');
215
-        });
213
+		$response = \Password::sendResetLink($email, function (\Illuminate\Mail\Message $message) {
214
+			$message->subject('Your Password Reset Link');
215
+		});
216 216
 
217
-        switch ($response) 
218
-        {
219
-            case \Password::INVALID_USER:
220
-                \ErrorHandler::notFound('email');
221
-        }
222
-    }
217
+		switch ($response) 
218
+		{
219
+			case \Password::INVALID_USER:
220
+				\ErrorHandler::notFound('email');
221
+		}
222
+	}
223 223
 
224
-    /**
225
-     * Reset the given user's password.
226
-     *
227
-     * @param  array  $credentials
228
-     * @return integer
229
-     */
230
-    public function resetPassword($credentials)
231
-    {
232
-        $token    = false;
233
-        $response = \Password::reset($credentials, function ($user, $password) use (&$token) {
234
-            $user->password = bcrypt($password);
235
-            $user->save();
224
+	/**
225
+	 * Reset the given user's password.
226
+	 *
227
+	 * @param  array  $credentials
228
+	 * @return integer
229
+	 */
230
+	public function resetPassword($credentials)
231
+	{
232
+		$token    = false;
233
+		$response = \Password::reset($credentials, function ($user, $password) use (&$token) {
234
+			$user->password = bcrypt($password);
235
+			$user->save();
236 236
 
237
-            $token = \JWTAuth::fromUser($user);
238
-        });
237
+			$token = \JWTAuth::fromUser($user);
238
+		});
239 239
 
240 240
 
241
-        switch ($response) {
242
-            case \Password::PASSWORD_RESET:
243
-                return $token;
241
+		switch ($response) {
242
+			case \Password::PASSWORD_RESET:
243
+				return $token;
244 244
                 
245
-            case \Password::INVALID_TOKEN:
246
-                \ErrorHandler::invalidResetToken('token');
245
+			case \Password::INVALID_TOKEN:
246
+				\ErrorHandler::invalidResetToken('token');
247 247
 
248
-            case \Password::INVALID_PASSWORD:
249
-                \ErrorHandler::invalidResetPassword('email');
248
+			case \Password::INVALID_PASSWORD:
249
+				\ErrorHandler::invalidResetPassword('email');
250 250
 
251
-            case \Password::INVALID_USER:
252
-                \ErrorHandler::notFound('user');
251
+			case \Password::INVALID_USER:
252
+				\ErrorHandler::notFound('user');
253 253
 
254
-            default:
255
-                \ErrorHandler::generalError();
256
-        }
257
-    }
254
+			default:
255
+				\ErrorHandler::generalError();
256
+		}
257
+	}
258 258
 }
Please login to merge, or discard this patch.
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -76,24 +76,19 @@  discard block
 block discarded – undo
76 76
         if ( ! $user = $this->first(['email' => $credentials['email']])) 
77 77
         {
78 78
             \ErrorHandler::loginFailed();
79
-        }
80
-        else if ($adminLogin && $user->groups->lists('name')->search('Admin', true) === false) 
79
+        } else if ($adminLogin && $user->groups->lists('name')->search('Admin', true) === false) 
81 80
         {
82 81
             \ErrorHandler::loginFailed();
83
-        }
84
-        else if ( ! $adminLogin && $user->groups->lists('name')->search('Admin', true) !== false) 
82
+        } else if ( ! $adminLogin && $user->groups->lists('name')->search('Admin', true) !== false) 
85 83
         {
86 84
             \ErrorHandler::loginFailed();
87
-        }
88
-        else if ($user->blocked)
85
+        } else if ($user->blocked)
89 86
         {
90 87
             \ErrorHandler::userIsBlocked();
91
-        }
92
-        else if ($token = \JWTAuth::attempt($credentials))
88
+        } else if ($token = \JWTAuth::attempt($credentials))
93 89
         {
94 90
             return ['token' => $token];
95
-        }
96
-        else
91
+        } else
97 92
         {
98 93
             \ErrorHandler::loginFailed();
99 94
         }
@@ -118,8 +113,7 @@  discard block
 block discarded – undo
118 113
         {
119 114
             $data = ['email' => $user->email, 'password' => ''];
120 115
             return $this->register($data);
121
-        }
122
-        else
116
+        } else
123 117
         {
124 118
             return $this->login(['email' => $registeredUser->email, 'password' => ''], false);
125 119
         }
@@ -161,12 +155,10 @@  discard block
 block discarded – undo
161 155
         if ( ! $this->hasGroup('Admin'))
162 156
         {
163 157
             \ErrorHandler::noPermissions();
164
-        }
165
-        else if (\JWTAuth::parseToken()->authenticate()->id == $user_id)
158
+        } else if (\JWTAuth::parseToken()->authenticate()->id == $user_id)
166 159
         {
167 160
             \ErrorHandler::noPermissions();
168
-        }
169
-        else if ($user->groups->lists('name')->search('Admin', true) !== false) 
161
+        } else if ($user->groups->lists('name')->search('Admin', true) !== false) 
170 162
         {
171 163
             \ErrorHandler::noPermissions();
172 164
         }
Please login to merge, or discard this patch.
src/Modules/V1/Core/Utl/ErrorHandler.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@
 block discarded – undo
70 70
 
71 71
     public function notFound($text)
72 72
     {
73
-        $error = ['status' => 404, 'message' => 'The requested ' . $text . ' not found'];
73
+        $error = ['status' => 404, 'message' => 'The requested '.$text.' not found'];
74 74
         abort($error['status'], $error['message']);
75 75
     }
76 76
 
Please login to merge, or discard this patch.
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -2,93 +2,93 @@
 block discarded – undo
2 2
 
3 3
 class ErrorHandler
4 4
 {
5
-    public function unAuthorized()
6
-    {
7
-        $error = ['status' => 401, 'message' => 'Please login before any action'];
8
-        abort($error['status'], $error['message']);
9
-    }
5
+	public function unAuthorized()
6
+	{
7
+		$error = ['status' => 401, 'message' => 'Please login before any action'];
8
+		abort($error['status'], $error['message']);
9
+	}
10 10
 
11
-    public function tokenExpired()
12
-    {
13
-        $error = ['status' => 403, 'message' => 'Login token expired'];
14
-        abort($error['status'], $error['message']);
15
-    }
11
+	public function tokenExpired()
12
+	{
13
+		$error = ['status' => 403, 'message' => 'Login token expired'];
14
+		abort($error['status'], $error['message']);
15
+	}
16 16
 
17
-     public function noPermissions()
18
-    {
19
-        $error = ['status' => 403, 'message' => 'No permissions'];
20
-        abort($error['status'], $error['message']);
21
-    }
17
+	 public function noPermissions()
18
+	{
19
+		$error = ['status' => 403, 'message' => 'No permissions'];
20
+		abort($error['status'], $error['message']);
21
+	}
22 22
 
23
-    public function loginFailed()
24
-    {
25
-        $error = ['status' => 400, 'message' => 'Wrong mail or password'];
26
-        abort($error['status'], $error['message']);
27
-    }
23
+	public function loginFailed()
24
+	{
25
+		$error = ['status' => 400, 'message' => 'Wrong mail or password'];
26
+		abort($error['status'], $error['message']);
27
+	}
28 28
 
29
-    public function accessTokenInValid()
30
-    {
31
-        $error = ['status' => 400, 'message' => 'The access token is invalid'];
32
-        abort($error['status'], $error['message']);
33
-    }
29
+	public function accessTokenInValid()
30
+	{
31
+		$error = ['status' => 400, 'message' => 'The access token is invalid'];
32
+		abort($error['status'], $error['message']);
33
+	}
34 34
 
35
-    public function noSocialEmail()
36
-    {
37
-        $error = ['status' => 400, 'message' => 'Couldn\'t retrieve email'];
38
-        abort($error['status'], $error['message']);
39
-    }
35
+	public function noSocialEmail()
36
+	{
37
+		$error = ['status' => 400, 'message' => 'Couldn\'t retrieve email'];
38
+		abort($error['status'], $error['message']);
39
+	}
40 40
     
41
-    public function redisNotRunning()
42
-    {
43
-        $error = ['status' => 400, 'message' => 'Your redis notification server isn\'t running'];
44
-        abort($error['status'], $error['message']);
45
-    }
41
+	public function redisNotRunning()
42
+	{
43
+		$error = ['status' => 400, 'message' => 'Your redis notification server isn\'t running'];
44
+		abort($error['status'], $error['message']);
45
+	}
46 46
 
47
-    public function dbQueryError()
48
-    {
49
-        $error = ['status' => 400, 'message' => 'Please check the given inputes'];
50
-        abort($error['status'], $error['message']);
51
-    }
47
+	public function dbQueryError()
48
+	{
49
+		$error = ['status' => 400, 'message' => 'Please check the given inputes'];
50
+		abort($error['status'], $error['message']);
51
+	}
52 52
 
53
-    public function cannotCreateSetting()
54
-    {
55
-        $error = ['status' => 400, 'message' => 'Can\'t create setting'];
56
-        abort($error['status'], $error['message']);
57
-    }
53
+	public function cannotCreateSetting()
54
+	{
55
+		$error = ['status' => 400, 'message' => 'Can\'t create setting'];
56
+		abort($error['status'], $error['message']);
57
+	}
58 58
 
59
-    public function cannotUpdateSettingKey()
60
-    {
61
-        $error = ['status' => 400, 'message' => 'Can\'t update setting key'];
62
-        abort($error['status'], $error['message']);
63
-    }
59
+	public function cannotUpdateSettingKey()
60
+	{
61
+		$error = ['status' => 400, 'message' => 'Can\'t update setting key'];
62
+		abort($error['status'], $error['message']);
63
+	}
64 64
 
65
-    public function userIsBlocked()
66
-    {
67
-        $error = ['status' => 403, 'message' => 'You have been blocked'];
68
-        abort($error['status'], $error['message']);
69
-    }
65
+	public function userIsBlocked()
66
+	{
67
+		$error = ['status' => 403, 'message' => 'You have been blocked'];
68
+		abort($error['status'], $error['message']);
69
+	}
70 70
 
71
-    public function invalidResetToken()
72
-    {
73
-        $error = ['status' => 400, 'message' => 'Reset password token is invalid'];
74
-        abort($error['status'], $error['message']);
75
-    }
71
+	public function invalidResetToken()
72
+	{
73
+		$error = ['status' => 400, 'message' => 'Reset password token is invalid'];
74
+		abort($error['status'], $error['message']);
75
+	}
76 76
 
77
-    public function invalidResetPassword()
78
-    {
79
-        $error = ['status' => 400, 'message' => 'Reset password is invalid'];
80
-        abort($error['status'], $error['message']);
81
-    }
77
+	public function invalidResetPassword()
78
+	{
79
+		$error = ['status' => 400, 'message' => 'Reset password is invalid'];
80
+		abort($error['status'], $error['message']);
81
+	}
82 82
 
83
-    public function notFound($text)
84
-    {
85
-        $error = ['status' => 404, 'message' => 'The requested ' . $text . ' not found'];
86
-        abort($error['status'], $error['message']);
87
-    }
83
+	public function notFound($text)
84
+	{
85
+		$error = ['status' => 404, 'message' => 'The requested ' . $text . ' not found'];
86
+		abort($error['status'], $error['message']);
87
+	}
88 88
 
89
-    public function generalError()
90
-    {
91
-        $error = ['status' => 400, 'message' => 'Something went wrong'];
92
-        abort($error['status'], $error['message']);
93
-    }
89
+	public function generalError()
90
+	{
91
+		$error = ['status' => 400, 'message' => 'Something went wrong'];
92
+		abort($error['status'], $error['message']);
93
+	}
94 94
 }
95 95
\ No newline at end of file
Please login to merge, or discard this patch.
Modules/V1/Acl/Database/Migrations/2015_12_20_124154_password_resets.php 2 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -5,27 +5,27 @@
 block discarded – undo
5 5
 
6 6
 class PasswordResets extends Migration
7 7
 {
8
-    /**
9
-     * Run the migrations.
10
-     *
11
-     * @return void
12
-     */
13
-    public function up()
14
-    {
15
-        Schema::create('password_resets', function (Blueprint $table) {
16
-            $table->string('email')->index();
17
-            $table->string('token')->index();
18
-            $table->timestamp('created_at');
19
-        });
20
-    }
8
+	/**
9
+	 * Run the migrations.
10
+	 *
11
+	 * @return void
12
+	 */
13
+	public function up()
14
+	{
15
+		Schema::create('password_resets', function (Blueprint $table) {
16
+			$table->string('email')->index();
17
+			$table->string('token')->index();
18
+			$table->timestamp('created_at');
19
+		});
20
+	}
21 21
 
22
-    /**
23
-     * Reverse the migrations.
24
-     *
25
-     * @return void
26
-     */
27
-    public function down()
28
-    {
29
-        Schema::drop('password_resets');
30
-    }
22
+	/**
23
+	 * Reverse the migrations.
24
+	 *
25
+	 * @return void
26
+	 */
27
+	public function down()
28
+	{
29
+		Schema::drop('password_resets');
30
+	}
31 31
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
      */
13 13
     public function up()
14 14
     {
15
-        Schema::create('password_resets', function (Blueprint $table) {
15
+        Schema::create('password_resets', function(Blueprint $table) {
16 16
             $table->string('email')->index();
17 17
             $table->string('token')->index();
18 18
             $table->timestamp('created_at');
Please login to merge, or discard this patch.
src/Modules/V1/Acl/Database/Migrations/2015_12_20_124153_users.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -13,15 +13,15 @@
 block discarded – undo
13 13
 	public function up()
14 14
 	{
15 15
 		Schema::create('users', function (Blueprint $table) {
16
-            $table->increments('id');
17
-            $table->string('name',100)->nullable();
18
-            $table->string('email')->unique();
19
-            $table->string('password', 60);
20
-            $table->boolean('blocked', 0);
21
-            $table->softDeletes();
22
-            $table->rememberToken();
23
-            $table->timestamps();
24
-        });
16
+			$table->increments('id');
17
+			$table->string('name',100)->nullable();
18
+			$table->string('email')->unique();
19
+			$table->string('password', 60);
20
+			$table->boolean('blocked', 0);
21
+			$table->softDeletes();
22
+			$table->rememberToken();
23
+			$table->timestamps();
24
+		});
25 25
 	}
26 26
 
27 27
 	/**
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@
 block discarded – undo
12 12
 	 */
13 13
 	public function up()
14 14
 	{
15
-		Schema::create('users', function (Blueprint $table) {
15
+		Schema::create('users', function(Blueprint $table) {
16 16
             $table->increments('id');
17
-            $table->string('name',100)->nullable();
17
+            $table->string('name', 100)->nullable();
18 18
             $table->string('email')->unique();
19 19
             $table->string('password', 60);
20 20
             $table->boolean('blocked', 0);
Please login to merge, or discard this patch.
src/ApiSkeletonServiceProvider.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -6,26 +6,26 @@
 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/V1/Acl/emails' => base_path('resources/views/auth/emails'),
19
-            ]);
20
-    }
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/V1/Acl/emails' => base_path('resources/views/auth/emails'),
19
+			]);
20
+	}
21 21
 
22
-    /**
23
-     * Register any package services.
24
-     *
25
-     * @return void
26
-     */
27
-    public function register()
28
-    {
29
-        //
30
-    }
22
+	/**
23
+	 * Register any package services.
24
+	 *
25
+	 * @return void
26
+	 */
27
+	public function register()
28
+	{
29
+		//
30
+	}
31 31
 }
32 32
\ No newline at end of file
Please login to merge, or discard this patch.
src/Modules/V1/Core/ModelObservers/SettingsObserver.php 1 patch
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -5,59 +5,59 @@
 block discarded – undo
5 5
  */
6 6
 class SettingsObserver {
7 7
 
8
-    public function saving($model)
9
-    {
10
-        //
11
-    }
12
-
13
-    public function saved($model)
14
-    {
15
-        //
16
-    }
17
-
18
-    /**
19
-     * Prevent the creating of the settings.
20
-     * 
21
-     * @param  object $model the model beign created.
22
-     * @return void
23
-     */
24
-    public function creating($model)
25
-    {
26
-        \ErrorHandler::cannotCreateSetting();
27
-    }
28
-
29
-    public function created($model)
30
-    {
31
-        //
32
-    }
33
-
34
-    /**
35
-     * Prevent updating of the setting key.
36
-     * 
37
-     * @param  object $model the model beign updated.
38
-     * @return void
39
-     */
40
-    public function updating($model)
41
-    {
42
-        if ($model->getOriginal()['key'] !== $model->key) 
43
-        {
44
-            \ErrorHandler::cannotUpdateSettingKey();
45
-        }
46
-    }
47
-
48
-    public function updated($model)
49
-    {
50
-        //
51
-    }
52
-
53
-    public function deleting($model)
54
-    {
55
-        //
56
-    }
57
-
58
-    public function deleted($model)
59
-    {
60
-        //
61
-    }
8
+	public function saving($model)
9
+	{
10
+		//
11
+	}
12
+
13
+	public function saved($model)
14
+	{
15
+		//
16
+	}
17
+
18
+	/**
19
+	 * Prevent the creating of the settings.
20
+	 * 
21
+	 * @param  object $model the model beign created.
22
+	 * @return void
23
+	 */
24
+	public function creating($model)
25
+	{
26
+		\ErrorHandler::cannotCreateSetting();
27
+	}
28
+
29
+	public function created($model)
30
+	{
31
+		//
32
+	}
33
+
34
+	/**
35
+	 * Prevent updating of the setting key.
36
+	 * 
37
+	 * @param  object $model the model beign updated.
38
+	 * @return void
39
+	 */
40
+	public function updating($model)
41
+	{
42
+		if ($model->getOriginal()['key'] !== $model->key) 
43
+		{
44
+			\ErrorHandler::cannotUpdateSettingKey();
45
+		}
46
+	}
47
+
48
+	public function updated($model)
49
+	{
50
+		//
51
+	}
52
+
53
+	public function deleting($model)
54
+	{
55
+		//
56
+	}
57
+
58
+	public function deleted($model)
59
+	{
60
+		//
61
+	}
62 62
 
63 63
 }
64 64
\ No newline at end of file
Please login to merge, or discard this patch.
src/Modules/V1/Core/Core.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 
3 3
 use App\Modules\V1\Core\AbstractRepositories\AbstractRepositoryContainer;
4 4
 
5
-class Core extends AbstractRepositoryContainer{
5
+class Core extends AbstractRepositoryContainer {
6 6
 	/**
7 7
 	 * Specify module repositories name space.
8 8
 	 * 
Please login to merge, or discard this patch.
src/Modules/V1/Core/Utl/Logging.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -2,17 +2,17 @@
 block discarded – undo
2 2
 
3 3
 class Logging
4 4
 {
5
-    public function saveLog($action, $item_name, $item_type, $item_id)
6
-    {
7
-    	if (\Core::logs() && $item_name !== 'Log')
8
-    	{
9
-    		\Core::logs()->save([
10
-	    		'action'      => $action,
11
-	    		'item_name'   => $item_name,
12
-	    		'item_type'   => $item_type,
13
-	    		'item_id'     => $item_id,
14
-	    		'user_id'     => \JWTAuth::parseToken()->authenticate()->id,
15
-	    		], false, false);
16
-    	}
17
-    }
5
+	public function saveLog($action, $item_name, $item_type, $item_id)
6
+	{
7
+		if (\Core::logs() && $item_name !== 'Log')
8
+		{
9
+			\Core::logs()->save([
10
+				'action'      => $action,
11
+				'item_name'   => $item_name,
12
+				'item_type'   => $item_type,
13
+				'item_id'     => $item_id,
14
+				'user_id'     => \JWTAuth::parseToken()->authenticate()->id,
15
+				], false, false);
16
+		}
17
+	}
18 18
 }
19 19
\ No newline at end of file
Please login to merge, or discard this patch.
Modules/V1/Notifications/ModelObservers/PushNotificationDeviceObserver.php 1 patch
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -5,44 +5,44 @@
 block discarded – undo
5 5
  */
6 6
 class LogObserver {
7 7
 
8
-    public function saving($model)
9
-    {
10
-        //
11
-    }
12
-
13
-    public function saved($model)
14
-    {
15
-        //
16
-    }
17
-
18
-    public function creating($model)
19
-    {
20
-        //
21
-    }
22
-
23
-    public function created($model)
24
-    {
25
-        //
26
-    }
27
-
28
-    public function updating($model)
29
-    {
30
-        //
31
-    }
32
-
33
-    public function updated($model)
34
-    {
35
-        //
36
-    }
37
-
38
-    public function deleting($model)
39
-    {
40
-        //
41
-    }
42
-
43
-    public function deleted($model)
44
-    {
45
-        //
46
-    }
8
+	public function saving($model)
9
+	{
10
+		//
11
+	}
12
+
13
+	public function saved($model)
14
+	{
15
+		//
16
+	}
17
+
18
+	public function creating($model)
19
+	{
20
+		//
21
+	}
22
+
23
+	public function created($model)
24
+	{
25
+		//
26
+	}
27
+
28
+	public function updating($model)
29
+	{
30
+		//
31
+	}
32
+
33
+	public function updated($model)
34
+	{
35
+		//
36
+	}
37
+
38
+	public function deleting($model)
39
+	{
40
+		//
41
+	}
42
+
43
+	public function deleted($model)
44
+	{
45
+		//
46
+	}
47 47
 
48 48
 }
49 49
\ No newline at end of file
Please login to merge, or discard this patch.