Completed
Push — master ( b79faa...aa40d3 )
by Sherif
14:14
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.
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.
Indentation   +234 added lines, -234 removed lines patch added patch discarded remove patch
@@ -4,268 +4,268 @@
 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
-        $access_token = $credentials['auth_code'] ? \Socialite::driver($credentials['type'])->getAccessToken($credentials['auth_code']) : $credentials['access_token'];   
111
-        $user         = \Socialite::driver($credentials['type'])->userFromToken($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
+		$access_token = $credentials['auth_code'] ? \Socialite::driver($credentials['type'])->getAccessToken($credentials['auth_code']) : $credentials['access_token'];   
111
+		$user         = \Socialite::driver($credentials['type'])->userFromToken($access_token);
112 112
 
113
-        if ( ! $user->email)
114
-        {
115
-            \ErrorHandler::noSocialEmail();
116
-        }
113
+		if ( ! $user->email)
114
+		{
115
+			\ErrorHandler::noSocialEmail();
116
+		}
117 117
 
118
-        if ( ! $registeredUser = $this->model->where('email', $user->email)->first()) 
119
-        {
120
-            $data = ['email' => $user->email, 'password' => ''];
121
-            return $this->register($data);
122
-        }
123
-        else
124
-        {
125
-            return $this->login(['email' => $registeredUser->email, 'password' => ''], false);
126
-        }
127
-    }
118
+		if ( ! $registeredUser = $this->model->where('email', $user->email)->first()) 
119
+		{
120
+			$data = ['email' => $user->email, 'password' => ''];
121
+			return $this->register($data);
122
+		}
123
+		else
124
+		{
125
+			return $this->login(['email' => $registeredUser->email, 'password' => ''], false);
126
+		}
127
+	}
128 128
     
129
-    /**
130
-     * Handle a registration request.
131
-     * 
132
-     * @param  array $credentials
133
-     * @return string
134
-     */
135
-    public function register($credentials)
136
-    {
137
-        return ['token' => \JWTAuth::fromUser($this->model->create($credentials))];
138
-    }
129
+	/**
130
+	 * Handle a registration request.
131
+	 * 
132
+	 * @param  array $credentials
133
+	 * @return string
134
+	 */
135
+	public function register($credentials)
136
+	{
137
+		return ['token' => \JWTAuth::fromUser($this->model->create($credentials))];
138
+	}
139 139
 
140
-    /**
141
-     * Logout the user.
142
-     * 
143
-     * @return boolean
144
-     */
145
-    public function logout()
146
-    {
147
-        return \JWTAuth::invalidate(\JWTAuth::getToken());
148
-    }
140
+	/**
141
+	 * Logout the user.
142
+	 * 
143
+	 * @return boolean
144
+	 */
145
+	public function logout()
146
+	{
147
+		return \JWTAuth::invalidate(\JWTAuth::getToken());
148
+	}
149 149
 
150
-    /**
151
-     * Block the user.
152
-     *
153
-     * @param  integer $user_id
154
-     * @return object
155
-     */
156
-    public function block($user_id)
157
-    {
158
-        if ( ! $user = $this->find($user_id)) 
159
-        {
160
-            \ErrorHandler::notFound('user');
161
-        }
162
-        if ( ! $this->hasGroup('Admin'))
163
-        {
164
-            \ErrorHandler::noPermissions();
165
-        }
166
-        else if (\JWTAuth::parseToken()->authenticate()->id == $user_id)
167
-        {
168
-            \ErrorHandler::noPermissions();
169
-        }
170
-        else if ($user->groups->lists('name')->search('Admin', true) !== false) 
171
-        {
172
-            \ErrorHandler::noPermissions();
173
-        }
150
+	/**
151
+	 * Block the user.
152
+	 *
153
+	 * @param  integer $user_id
154
+	 * @return object
155
+	 */
156
+	public function block($user_id)
157
+	{
158
+		if ( ! $user = $this->find($user_id)) 
159
+		{
160
+			\ErrorHandler::notFound('user');
161
+		}
162
+		if ( ! $this->hasGroup('Admin'))
163
+		{
164
+			\ErrorHandler::noPermissions();
165
+		}
166
+		else if (\JWTAuth::parseToken()->authenticate()->id == $user_id)
167
+		{
168
+			\ErrorHandler::noPermissions();
169
+		}
170
+		else if ($user->groups->lists('name')->search('Admin', true) !== false) 
171
+		{
172
+			\ErrorHandler::noPermissions();
173
+		}
174 174
 
175
-        $user->blocked = 1;
176
-        $user->save();
175
+		$user->blocked = 1;
176
+		$user->save();
177 177
         
178
-        return $user;
179
-    }
178
+		return $user;
179
+	}
180 180
 
181
-    /**
182
-     * Unblock the user.
183
-     *
184
-     * @param  integer $user_id
185
-     * @return object
186
-     */
187
-    public function unblock($user_id)
188
-    {
189
-        if ( ! $this->hasGroup('Admin'))
190
-        {
191
-            \ErrorHandler::noPermissions();
192
-        }
181
+	/**
182
+	 * Unblock the user.
183
+	 *
184
+	 * @param  integer $user_id
185
+	 * @return object
186
+	 */
187
+	public function unblock($user_id)
188
+	{
189
+		if ( ! $this->hasGroup('Admin'))
190
+		{
191
+			\ErrorHandler::noPermissions();
192
+		}
193 193
 
194
-        $user          = $this->find($user_id);
195
-        $user->blocked = 0;
196
-        $user->save();
194
+		$user          = $this->find($user_id);
195
+		$user->blocked = 0;
196
+		$user->save();
197 197
 
198
-        return $user;
199
-    }
198
+		return $user;
199
+	}
200 200
 
201
-    /**
202
-     * Send a reset link to the given user.
203
-     *
204
-     * @param  string  $url
205
-     * @param  string  $email
206
-     * @return void
207
-     */
208
-    public function sendReset($email, $url)
209
-    {
210
-        view()->composer('auth.emails.password', function($view) use ($url) {
211
-            $view->with(['url' => $url]);
212
-        });
201
+	/**
202
+	 * Send a reset link to the given user.
203
+	 *
204
+	 * @param  string  $url
205
+	 * @param  string  $email
206
+	 * @return void
207
+	 */
208
+	public function sendReset($email, $url)
209
+	{
210
+		view()->composer('auth.emails.password', function($view) use ($url) {
211
+			$view->with(['url' => $url]);
212
+		});
213 213
 
214
-        $response = \Password::sendResetLink($email, function (\Illuminate\Mail\Message $message) {
215
-            $message->subject('Your Password Reset Link');
216
-        });
214
+		$response = \Password::sendResetLink($email, function (\Illuminate\Mail\Message $message) {
215
+			$message->subject('Your Password Reset Link');
216
+		});
217 217
 
218
-        switch ($response) 
219
-        {
220
-            case \Password::INVALID_USER:
221
-                \ErrorHandler::notFound('email');
222
-        }
223
-    }
218
+		switch ($response) 
219
+		{
220
+			case \Password::INVALID_USER:
221
+				\ErrorHandler::notFound('email');
222
+		}
223
+	}
224 224
 
225
-    /**
226
-     * Reset the given user's password.
227
-     *
228
-     * @param  array  $credentials
229
-     * @return integer
230
-     */
231
-    public function resetPassword($credentials)
232
-    {
233
-        $token    = false;
234
-        $response = \Password::reset($credentials, function ($user, $password) use (&$token) {
235
-            $user->password = bcrypt($password);
236
-            $user->save();
225
+	/**
226
+	 * Reset the given user's password.
227
+	 *
228
+	 * @param  array  $credentials
229
+	 * @return integer
230
+	 */
231
+	public function resetPassword($credentials)
232
+	{
233
+		$token    = false;
234
+		$response = \Password::reset($credentials, function ($user, $password) use (&$token) {
235
+			$user->password = bcrypt($password);
236
+			$user->save();
237 237
 
238
-            $token = \JWTAuth::fromUser($user);
239
-        });
238
+			$token = \JWTAuth::fromUser($user);
239
+		});
240 240
 
241 241
 
242
-        switch ($response) {
243
-            case \Password::PASSWORD_RESET:
244
-                return $token;
242
+		switch ($response) {
243
+			case \Password::PASSWORD_RESET:
244
+				return $token;
245 245
                 
246
-            case \Password::INVALID_TOKEN:
247
-                \ErrorHandler::invalidResetToken('token');
246
+			case \Password::INVALID_TOKEN:
247
+				\ErrorHandler::invalidResetToken('token');
248 248
 
249
-            case \Password::INVALID_PASSWORD:
250
-                \ErrorHandler::invalidResetPassword('email');
249
+			case \Password::INVALID_PASSWORD:
250
+				\ErrorHandler::invalidResetPassword('email');
251 251
 
252
-            case \Password::INVALID_USER:
253
-                \ErrorHandler::notFound('user');
252
+			case \Password::INVALID_USER:
253
+				\ErrorHandler::notFound('user');
254 254
 
255
-            default:
256
-                \ErrorHandler::generalError();
257
-        }
258
-    }
255
+			default:
256
+				\ErrorHandler::generalError();
257
+		}
258
+	}
259 259
 
260
-    /**
261
-     * Refresh the expired login token.
262
-     *
263
-     * @return string
264
-     */
265
-    public function refreshtoken()
266
-    {
267
-        $token = \JWTAuth::parseToken()->refresh();
260
+	/**
261
+	 * Refresh the expired login token.
262
+	 *
263
+	 * @return string
264
+	 */
265
+	public function refreshtoken()
266
+	{
267
+		$token = \JWTAuth::parseToken()->refresh();
268 268
 
269
-        return ['token' => $token];
270
-    }
269
+		return ['token' => $token];
270
+	}
271 271
 }
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 loginFailedSocial()
30
-    {
31
-        $error = ['status' => 400, 'message' => 'Wrong auth code or acces token'];
32
-        abort($error['status'], $error['message']);
33
-    }
29
+	public function loginFailedSocial()
30
+	{
31
+		$error = ['status' => 400, 'message' => 'Wrong auth code or acces token'];
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.