Completed
Push — master ( aa40d3...882deb )
by Sherif
07:55
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   +237 added lines, -237 removed lines patch added patch discarded remove patch
@@ -4,271 +4,271 @@
 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
-        $group       = \Session::get('group');
31
-        \Session::set('group', null);
32
-        $this->find($user->id, ['groups.permissions'])->groups->lists('permissions')->each(function ($permission) use (&$permissions, $model){
33
-            $permissions = array_merge($permissions, $permission->where('model', $model)->lists('name')->toArray()); 
34
-        });
35
-        \Session::set('group', $group);
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
+		$group       = \Session::get('group');
31
+		\Session::set('group', null);
32
+		$this->find($user->id, ['groups.permissions'])->groups->lists('permissions')->each(function ($permission) use (&$permissions, $model){
33
+			$permissions = array_merge($permissions, $permission->where('model', $model)->lists('name')->toArray()); 
34
+		});
35
+		\Session::set('group', $group);
36 36
         
37
-        return in_array($nameOfPermission, $permissions);
38
-    }
37
+		return in_array($nameOfPermission, $permissions);
38
+	}
39 39
 
40
-    /**
41
-     * Check if the logged in user has the given group.
42
-     * 
43
-     * @param  string  $groupName
44
-     * @return boolean
45
-     */
46
-    public function hasGroup($groupName)
47
-    {
48
-        $groups = $this->find(\JWTAuth::parseToken()->authenticate()->id)->groups;
49
-        return $groups->lists('name')->search($groupName, true) === false ? false : true;
50
-    }
40
+	/**
41
+	 * Check if the logged in user has the given group.
42
+	 * 
43
+	 * @param  string  $groupName
44
+	 * @return boolean
45
+	 */
46
+	public function hasGroup($groupName)
47
+	{
48
+		$groups = $this->find(\JWTAuth::parseToken()->authenticate()->id)->groups;
49
+		return $groups->lists('name')->search($groupName, true) === false ? false : true;
50
+	}
51 51
 
52
-    /**
53
-     * Assign the given group ids to the given user.
54
-     * 
55
-     * @param  integer $user_id    
56
-     * @param  array   $group_ids
57
-     * @return object
58
-     */
59
-    public function assignGroups($user_id, $group_ids)
60
-    {
61
-        \DB::transaction(function () use ($user_id, $group_ids) {
62
-            $user = $this->find($user_id);
63
-            $user->groups()->detach();
64
-            $user->groups()->attach($group_ids);
65
-        });
52
+	/**
53
+	 * Assign the given group ids to the given user.
54
+	 * 
55
+	 * @param  integer $user_id    
56
+	 * @param  array   $group_ids
57
+	 * @return object
58
+	 */
59
+	public function assignGroups($user_id, $group_ids)
60
+	{
61
+		\DB::transaction(function () use ($user_id, $group_ids) {
62
+			$user = $this->find($user_id);
63
+			$user->groups()->detach();
64
+			$user->groups()->attach($group_ids);
65
+		});
66 66
 
67
-        return $this->find($user_id);
68
-    }
67
+		return $this->find($user_id);
68
+	}
69 69
 
70
-    /**
71
-     * Handle a login request to the application.
72
-     * 
73
-     * @param  array   $credentials    
74
-     * @param  boolean $adminLogin
75
-     * @return string
76
-     */
77
-    public function login($credentials, $adminLogin = false)
78
-    {
79
-        if ( ! $user = $this->first(['email' => $credentials['email']])) 
80
-        {
81
-            \ErrorHandler::loginFailed();
82
-        }
83
-        else if ($adminLogin && $user->groups->lists('name')->search('Admin', true) === false) 
84
-        {
85
-            \ErrorHandler::loginFailed();
86
-        }
87
-        else if ( ! $adminLogin && $user->groups->lists('name')->search('Admin', true) !== false) 
88
-        {
89
-            \ErrorHandler::loginFailed();
90
-        }
91
-        else if ($user->blocked)
92
-        {
93
-            \ErrorHandler::userIsBlocked();
94
-        }
95
-        else if ($token = \JWTAuth::attempt($credentials))
96
-        {
97
-            return ['token' => $token];
98
-        }
99
-        else
100
-        {
101
-            \ErrorHandler::loginFailed();
102
-        }
103
-    }
70
+	/**
71
+	 * Handle a login request to the application.
72
+	 * 
73
+	 * @param  array   $credentials    
74
+	 * @param  boolean $adminLogin
75
+	 * @return string
76
+	 */
77
+	public function login($credentials, $adminLogin = false)
78
+	{
79
+		if ( ! $user = $this->first(['email' => $credentials['email']])) 
80
+		{
81
+			\ErrorHandler::loginFailed();
82
+		}
83
+		else if ($adminLogin && $user->groups->lists('name')->search('Admin', true) === false) 
84
+		{
85
+			\ErrorHandler::loginFailed();
86
+		}
87
+		else if ( ! $adminLogin && $user->groups->lists('name')->search('Admin', true) !== false) 
88
+		{
89
+			\ErrorHandler::loginFailed();
90
+		}
91
+		else if ($user->blocked)
92
+		{
93
+			\ErrorHandler::userIsBlocked();
94
+		}
95
+		else if ($token = \JWTAuth::attempt($credentials))
96
+		{
97
+			return ['token' => $token];
98
+		}
99
+		else
100
+		{
101
+			\ErrorHandler::loginFailed();
102
+		}
103
+	}
104 104
 
105
-    /**
106
-     * Handle a social login request of the none admin to the application.
107
-     * 
108
-     * @param  array   $credentials
109
-     * @return string
110
-     */
111
-    public function loginSocial($credentials)
112
-    {
113
-        $access_token = $credentials['auth_code'] ? \Socialite::driver($credentials['type'])->getAccessToken($credentials['auth_code']) : $credentials['access_token'];   
114
-        $user         = \Socialite::driver($credentials['type'])->userFromToken($access_token);
105
+	/**
106
+	 * Handle a social login request of the none admin to the application.
107
+	 * 
108
+	 * @param  array   $credentials
109
+	 * @return string
110
+	 */
111
+	public function loginSocial($credentials)
112
+	{
113
+		$access_token = $credentials['auth_code'] ? \Socialite::driver($credentials['type'])->getAccessToken($credentials['auth_code']) : $credentials['access_token'];   
114
+		$user         = \Socialite::driver($credentials['type'])->userFromToken($access_token);
115 115
 
116
-        if ( ! $user->email)
117
-        {
118
-            \ErrorHandler::noSocialEmail();
119
-        }
116
+		if ( ! $user->email)
117
+		{
118
+			\ErrorHandler::noSocialEmail();
119
+		}
120 120
 
121
-        if ( ! $registeredUser = $this->model->where('email', $user->email)->first()) 
122
-        {
123
-            $data = ['email' => $user->email, 'password' => ''];
124
-            return $this->register($data);
125
-        }
126
-        else
127
-        {
128
-            return $this->login(['email' => $registeredUser->email, 'password' => ''], false);
129
-        }
130
-    }
121
+		if ( ! $registeredUser = $this->model->where('email', $user->email)->first()) 
122
+		{
123
+			$data = ['email' => $user->email, 'password' => ''];
124
+			return $this->register($data);
125
+		}
126
+		else
127
+		{
128
+			return $this->login(['email' => $registeredUser->email, 'password' => ''], false);
129
+		}
130
+	}
131 131
     
132
-    /**
133
-     * Handle a registration request.
134
-     * 
135
-     * @param  array $credentials
136
-     * @return string
137
-     */
138
-    public function register($credentials)
139
-    {
140
-        return ['token' => \JWTAuth::fromUser($this->model->create($credentials))];
141
-    }
132
+	/**
133
+	 * Handle a registration request.
134
+	 * 
135
+	 * @param  array $credentials
136
+	 * @return string
137
+	 */
138
+	public function register($credentials)
139
+	{
140
+		return ['token' => \JWTAuth::fromUser($this->model->create($credentials))];
141
+	}
142 142
 
143
-    /**
144
-     * Logout the user.
145
-     * 
146
-     * @return boolean
147
-     */
148
-    public function logout()
149
-    {
150
-        return \JWTAuth::invalidate(\JWTAuth::getToken());
151
-    }
143
+	/**
144
+	 * Logout the user.
145
+	 * 
146
+	 * @return boolean
147
+	 */
148
+	public function logout()
149
+	{
150
+		return \JWTAuth::invalidate(\JWTAuth::getToken());
151
+	}
152 152
 
153
-    /**
154
-     * Block the user.
155
-     *
156
-     * @param  integer $user_id
157
-     * @return object
158
-     */
159
-    public function block($user_id)
160
-    {
161
-        if ( ! $user = $this->find($user_id)) 
162
-        {
163
-            \ErrorHandler::notFound('user');
164
-        }
165
-        if ( ! $this->hasGroup('Admin'))
166
-        {
167
-            \ErrorHandler::noPermissions();
168
-        }
169
-        else if (\JWTAuth::parseToken()->authenticate()->id == $user_id)
170
-        {
171
-            \ErrorHandler::noPermissions();
172
-        }
173
-        else if ($user->groups->lists('name')->search('Admin', true) !== false) 
174
-        {
175
-            \ErrorHandler::noPermissions();
176
-        }
153
+	/**
154
+	 * Block the user.
155
+	 *
156
+	 * @param  integer $user_id
157
+	 * @return object
158
+	 */
159
+	public function block($user_id)
160
+	{
161
+		if ( ! $user = $this->find($user_id)) 
162
+		{
163
+			\ErrorHandler::notFound('user');
164
+		}
165
+		if ( ! $this->hasGroup('Admin'))
166
+		{
167
+			\ErrorHandler::noPermissions();
168
+		}
169
+		else if (\JWTAuth::parseToken()->authenticate()->id == $user_id)
170
+		{
171
+			\ErrorHandler::noPermissions();
172
+		}
173
+		else if ($user->groups->lists('name')->search('Admin', true) !== false) 
174
+		{
175
+			\ErrorHandler::noPermissions();
176
+		}
177 177
 
178
-        $user->blocked = 1;
179
-        $user->save();
178
+		$user->blocked = 1;
179
+		$user->save();
180 180
         
181
-        return $user;
182
-    }
181
+		return $user;
182
+	}
183 183
 
184
-    /**
185
-     * Unblock the user.
186
-     *
187
-     * @param  integer $user_id
188
-     * @return object
189
-     */
190
-    public function unblock($user_id)
191
-    {
192
-        if ( ! $this->hasGroup('Admin'))
193
-        {
194
-            \ErrorHandler::noPermissions();
195
-        }
184
+	/**
185
+	 * Unblock the user.
186
+	 *
187
+	 * @param  integer $user_id
188
+	 * @return object
189
+	 */
190
+	public function unblock($user_id)
191
+	{
192
+		if ( ! $this->hasGroup('Admin'))
193
+		{
194
+			\ErrorHandler::noPermissions();
195
+		}
196 196
 
197
-        $user          = $this->find($user_id);
198
-        $user->blocked = 0;
199
-        $user->save();
197
+		$user          = $this->find($user_id);
198
+		$user->blocked = 0;
199
+		$user->save();
200 200
 
201
-        return $user;
202
-    }
201
+		return $user;
202
+	}
203 203
 
204
-    /**
205
-     * Send a reset link to the given user.
206
-     *
207
-     * @param  string  $url
208
-     * @param  string  $email
209
-     * @return void
210
-     */
211
-    public function sendReset($email, $url)
212
-    {
213
-        view()->composer('auth.emails.password', function($view) use ($url) {
214
-            $view->with(['url' => $url]);
215
-        });
204
+	/**
205
+	 * Send a reset link to the given user.
206
+	 *
207
+	 * @param  string  $url
208
+	 * @param  string  $email
209
+	 * @return void
210
+	 */
211
+	public function sendReset($email, $url)
212
+	{
213
+		view()->composer('auth.emails.password', function($view) use ($url) {
214
+			$view->with(['url' => $url]);
215
+		});
216 216
 
217
-        $response = \Password::sendResetLink($email, function (\Illuminate\Mail\Message $message) {
218
-            $message->subject('Your Password Reset Link');
219
-        });
217
+		$response = \Password::sendResetLink($email, function (\Illuminate\Mail\Message $message) {
218
+			$message->subject('Your Password Reset Link');
219
+		});
220 220
 
221
-        switch ($response) 
222
-        {
223
-            case \Password::INVALID_USER:
224
-                \ErrorHandler::notFound('email');
225
-        }
226
-    }
221
+		switch ($response) 
222
+		{
223
+			case \Password::INVALID_USER:
224
+				\ErrorHandler::notFound('email');
225
+		}
226
+	}
227 227
 
228
-    /**
229
-     * Reset the given user's password.
230
-     *
231
-     * @param  array  $credentials
232
-     * @return integer
233
-     */
234
-    public function resetPassword($credentials)
235
-    {
236
-        $token    = false;
237
-        $response = \Password::reset($credentials, function ($user, $password) use (&$token) {
238
-            $user->password = bcrypt($password);
239
-            $user->save();
228
+	/**
229
+	 * Reset the given user's password.
230
+	 *
231
+	 * @param  array  $credentials
232
+	 * @return integer
233
+	 */
234
+	public function resetPassword($credentials)
235
+	{
236
+		$token    = false;
237
+		$response = \Password::reset($credentials, function ($user, $password) use (&$token) {
238
+			$user->password = bcrypt($password);
239
+			$user->save();
240 240
 
241
-            $token = \JWTAuth::fromUser($user);
242
-        });
241
+			$token = \JWTAuth::fromUser($user);
242
+		});
243 243
 
244 244
 
245
-        switch ($response) {
246
-            case \Password::PASSWORD_RESET:
247
-                return $token;
245
+		switch ($response) {
246
+			case \Password::PASSWORD_RESET:
247
+				return $token;
248 248
                 
249
-            case \Password::INVALID_TOKEN:
250
-                \ErrorHandler::invalidResetToken('token');
249
+			case \Password::INVALID_TOKEN:
250
+				\ErrorHandler::invalidResetToken('token');
251 251
 
252
-            case \Password::INVALID_PASSWORD:
253
-                \ErrorHandler::invalidResetPassword('email');
252
+			case \Password::INVALID_PASSWORD:
253
+				\ErrorHandler::invalidResetPassword('email');
254 254
 
255
-            case \Password::INVALID_USER:
256
-                \ErrorHandler::notFound('user');
255
+			case \Password::INVALID_USER:
256
+				\ErrorHandler::notFound('user');
257 257
 
258
-            default:
259
-                \ErrorHandler::generalError();
260
-        }
261
-    }
258
+			default:
259
+				\ErrorHandler::generalError();
260
+		}
261
+	}
262 262
 
263
-    /**
264
-     * Refresh the expired login token.
265
-     *
266
-     * @return string
267
-     */
268
-    public function refreshtoken()
269
-    {
270
-        $token = \JWTAuth::parseToken()->refresh();
263
+	/**
264
+	 * Refresh the expired login token.
265
+	 *
266
+	 * @return string
267
+	 */
268
+	public function refreshtoken()
269
+	{
270
+		$token = \JWTAuth::parseToken()->refresh();
271 271
 
272
-        return ['token' => $token];
273
-    }
272
+		return ['token' => $token];
273
+	}
274 274
 }
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.