Completed
Push — master ( c2b02d...e85db7 )
by Sherif
01:51
created
src/Modules/Core/AbstractRepositories/AbstractRepository.php 1 patch
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -621,14 +621,12 @@  discard block
 block discarded – undo
621 621
 				$conditions       = $this->constructConditions($value, $model);
622 622
 				$conditionString .= str_replace('{op}', 'and', $conditions['conditionString']).' {op} ';
623 623
 				$conditionValues  = array_merge($conditionValues, $conditions['conditionValues']);
624
-			}
625
-			else if ($key == 'or')
624
+			} else if ($key == 'or')
626 625
 			{
627 626
 				$conditions       = $this->constructConditions($value, $model);
628 627
 				$conditionString .= str_replace('{op}', 'or', $conditions['conditionString']).' {op} ';
629 628
 				$conditionValues  = array_merge($conditionValues, $conditions['conditionValues']);
630
-			}
631
-			else
629
+			} else
632 630
 			{
633 631
 				if (is_array($value)) 
634 632
 				{
@@ -653,29 +651,24 @@  discard block
 block discarded – undo
653 651
 
654 652
 					$conditionString  .= $key.' <= ? {op} ';
655 653
 					$conditionValues[] = $value2;
656
-				}
657
-				elseif (strtolower($operator) == 'in') 
654
+				} elseif (strtolower($operator) == 'in') 
658 655
 				{
659 656
 					$conditionValues  = array_merge($conditionValues, $value);
660 657
 					$inBindingsString = rtrim(str_repeat('?,', count($value)), ',');
661 658
 					$conditionString .= $key.' in ('.rtrim($inBindingsString, ',').') {op} ';
662
-				}
663
-				elseif (strtolower($operator) == 'null') 
659
+				} elseif (strtolower($operator) == 'null') 
664 660
 				{
665 661
 					$conditionString .= $key.' is null {op} ';
666
-				}
667
-				elseif (strtolower($operator) == 'not null') 
662
+				} elseif (strtolower($operator) == 'not null') 
668 663
 				{
669 664
 					$conditionString .= $key.' is not null {op} ';
670
-				}
671
-				elseif (strtolower($operator) == 'has') 
665
+				} elseif (strtolower($operator) == 'has') 
672 666
 				{
673 667
 					$sql              = $model->withTrashed()->has($key)->toSql();
674 668
 					$conditions       = $this->constructConditions($value, $model->$key()->getRelated());
675 669
 					$conditionString .= rtrim(substr($sql, strpos($sql, 'exists')), ')').' and '.$conditions['conditionString'].') {op} ';
676 670
 					$conditionValues  = array_merge($conditionValues, $conditions['conditionValues']);
677
-				}
678
-				else
671
+				} else
679 672
 				{
680 673
 					$conditionString  .= $key.' '.$operator.' ? {op} ';
681 674
 					$conditionValues[] = $value;
Please login to merge, or discard this patch.
src/Modules/Core/Http/Controllers/BaseApiController.php 2 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -227,10 +227,8 @@
 block discarded – undo
227 227
 			}
228 228
 
229 229
 			if ($isPasswordClient && (in_array($permission, $this->skipPermissionCheck) || \Core::users()->can($permission, $this->model)))
230
-			{}
231
-			elseif ( ! $isPasswordClient && $user->tokenCan($this->model.'-'.$permission)) 
232
-			{}
233
-			else
230
+			{} elseif ( ! $isPasswordClient && $user->tokenCan($this->model.'-'.$permission)) 
231
+			{} else
234 232
 			{
235 233
 
236 234
 				\ErrorHandler::noPermissions();
Please login to merge, or discard this patch.
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
 			return $next($request);
44 44
 		});
45 45
 
46
-        $this->setSessions();
47
-        $this->checkPermission($route);
48
-        $this->setRelations($route);
46
+		$this->setSessions();
47
+		$this->checkPermission($route);
48
+		$this->setRelations($route);
49 49
 	}
50 50
 
51 51
 	/**
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 			$user             = \Auth::user();
222 222
 			$permission       = $permission !== 'index' ? $permission : 'list';
223 223
 			$isPasswordClient = $user->token()->client->password_client;
224
-            $this->updateLocaleAndTimezone($user);
224
+			$this->updateLocaleAndTimezone($user);
225 225
 
226 226
 			if ($user->blocked)
227 227
 			{
@@ -287,32 +287,32 @@  discard block
 block discarded – undo
287 287
 		$this->relations = $relations && isset($relations[$route]) ? $relations[$route] : [];
288 288
 	}
289 289
 
290
-    /**
291
-     * Update the logged in user locale and time zone.
292
-     * 
293
-     * @param  object $user
294
-     * @return void
295
-     */
296
-    private function updateLocaleAndTimezone($user)
297
-    {   
298
-        $update   = false;
299
-        $locale   = \Session::get('locale');
300
-        $timezone = \Session::get('time-zone');
301
-        if ($locale && $locale !== 'all' && $locale !== $user->locale)
302
-        {
303
-            $user->locale = $locale;
304
-            $update       = true;
305
-        }
306
-
307
-        if ($timezone && $timezone !== $user->timezone)
308
-        {
309
-            $user->timezone = $timezone;
310
-            $update       = true;
311
-        }
312
-
313
-        if ($update) 
314
-        {
315
-            $user->save();
316
-        }
317
-    }
290
+	/**
291
+	 * Update the logged in user locale and time zone.
292
+	 * 
293
+	 * @param  object $user
294
+	 * @return void
295
+	 */
296
+	private function updateLocaleAndTimezone($user)
297
+	{   
298
+		$update   = false;
299
+		$locale   = \Session::get('locale');
300
+		$timezone = \Session::get('time-zone');
301
+		if ($locale && $locale !== 'all' && $locale !== $user->locale)
302
+		{
303
+			$user->locale = $locale;
304
+			$update       = true;
305
+		}
306
+
307
+		if ($timezone && $timezone !== $user->timezone)
308
+		{
309
+			$user->timezone = $timezone;
310
+			$update       = true;
311
+		}
312
+
313
+		if ($update) 
314
+		{
315
+			$user->save();
316
+		}
317
+	}
318 318
 }
Please login to merge, or discard this patch.
src/Modules/Core/Console/Commands/GenerateDoc.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -174,14 +174,12 @@
 block discarded – undo
174 174
 					if (strpos($rule, 'unique'))
175 175
 					{
176 176
 						$rule = substr($rule, 0, strpos($rule, 'unique') + 6);
177
-					}
178
-					elseif (strpos($rule, 'exists'))
177
+					} elseif (strpos($rule, 'exists'))
179 178
 					{
180 179
 						$rule = substr($rule, 0, strpos($rule, 'exists') - 1);
181 180
 					}
182 181
 				}
183
-			}
184
-			else
182
+			} else
185 183
 			{
186 184
 				$route['body'] = 'conditions';
187 185
 			}
Please login to merge, or discard this patch.
src/Modules/Reporting/Repositories/ReportRepository.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,8 +39,7 @@
 block discarded – undo
39 39
 		if ( ! $report) 
40 40
 		{
41 41
 			\ErrorHandler::notFound('report');
42
-		}
43
-		else if ( ! $skipPermission && ! \Core::users()->can($report->view_name, 'reports'))
42
+		} else if ( ! $skipPermission && ! \Core::users()->can($report->view_name, 'reports'))
44 43
 		{
45 44
 			\ErrorHandler::noPermissions();
46 45
 		}
Please login to merge, or discard this patch.
src/Modules/Acl/Database/Migrations/2015_12_20_124153_users.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -13,26 +13,26 @@  discard block
 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('profile_picture', 150)->nullable();
18
-            $table->string('name', 100)->nullable();
19
-            $table->string('email')->unique();
20
-            $table->string('password', 60)->nullable();
21
-            $table->boolean('blocked')->default(0);
22
-            $table->boolean('confirmed')->default(0);
23
-            $table->string('confirmation_code')->nullable();
24
-            $table->string('locale', 2)->default('en');
25
-            $table->string('timezone', 50)->default('Africa/Cairo');
26
-            $table->softDeletes();
27
-            $table->rememberToken();
28
-            $table->timestamps();
29
-        });
16
+			$table->increments('id');
17
+			$table->string('profile_picture', 150)->nullable();
18
+			$table->string('name', 100)->nullable();
19
+			$table->string('email')->unique();
20
+			$table->string('password', 60)->nullable();
21
+			$table->boolean('blocked')->default(0);
22
+			$table->boolean('confirmed')->default(0);
23
+			$table->string('confirmation_code')->nullable();
24
+			$table->string('locale', 2)->default('en');
25
+			$table->string('timezone', 50)->default('Africa/Cairo');
26
+			$table->softDeletes();
27
+			$table->rememberToken();
28
+			$table->timestamps();
29
+		});
30 30
 
31 31
 		/**
32 32
 		 * Create Default users.
33 33
 		 */
34 34
 		\DB::table('users')->insertGetId(
35
-            [
35
+			[
36 36
 			'name'       => 'Admin',
37 37
 			'email'      => '[email protected]',
38 38
 			'password'   => bcrypt('123456'),
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 			'created_at' => \DB::raw('NOW()'),
41 41
 			'updated_at' => \DB::raw('NOW()')
42 42
 			]
43
-        );
43
+		);
44 44
 	}
45 45
 
46 46
 	/**
Please login to merge, or discard this patch.
src/Modules/Acl/ModelObservers/AclUserObserver.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@
 block discarded – undo
7 7
 
8 8
 	public function saving($model)
9 9
 	{
10
-        if ($model->isDirty('profile_picture')) 
11
-        {
12
-            \Media::deleteImage($model->getOriginal('profile_picture'));
13
-        }
10
+		if ($model->isDirty('profile_picture')) 
11
+		{
12
+			\Media::deleteImage($model->getOriginal('profile_picture'));
13
+		}
14 14
 	}
15 15
 
16 16
 	public function saved($model)
Please login to merge, or discard this patch.
src/Modules/Core/Utl/Media.php 1 patch
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -2,63 +2,63 @@
 block discarded – undo
2 2
 
3 3
 class Media
4 4
 {
5
-    /**
6
-     * Upload the given image.
7
-     * 
8
-     * @param  object  $image
9
-     * @param  string  $dir
10
-     * @return string
11
-     */
12
-    public function uploadImage($image, $dir) 
13
-    {
14
-        $image = \Image::make($image);
15
-        return $this->saveImage($image, $dir);
16
-    }
5
+	/**
6
+	 * Upload the given image.
7
+	 * 
8
+	 * @param  object  $image
9
+	 * @param  string  $dir
10
+	 * @return string
11
+	 */
12
+	public function uploadImage($image, $dir) 
13
+	{
14
+		$image = \Image::make($image);
15
+		return $this->saveImage($image, $dir);
16
+	}
17 17
 
18
-    /**
19
-     * Upload the given image.
20
-     * 
21
-     * @param  object  $image
22
-     * @param  string  $dir
23
-     * @return string
24
-     */
25
-    public function uploadImageBas64($image, $dir) 
26
-    {
27
-        if ( ! strlen($image)) 
28
-        {
29
-            return null;
30
-        }
18
+	/**
19
+	 * Upload the given image.
20
+	 * 
21
+	 * @param  object  $image
22
+	 * @param  string  $dir
23
+	 * @return string
24
+	 */
25
+	public function uploadImageBas64($image, $dir) 
26
+	{
27
+		if ( ! strlen($image)) 
28
+		{
29
+			return null;
30
+		}
31 31
 
32
-        $base  = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $image));
33
-        $image = \Image::make($base);
32
+		$base  = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $image));
33
+		$image = \Image::make($base);
34 34
 
35
-        return $this->saveImage($image, $dir);
36
-    }
35
+		return $this->saveImage($image, $dir);
36
+	}
37 37
 
38
-    /**
39
-     * Delete the given image.
40
-     * 
41
-     * @param  object $path
42
-     * @return void
43
-     */
44
-    public function deleteImage($path) 
45
-    {   
46
-        \Storage::delete($path);
47
-    }
38
+	/**
39
+	 * Delete the given image.
40
+	 * 
41
+	 * @param  object $path
42
+	 * @return void
43
+	 */
44
+	public function deleteImage($path) 
45
+	{   
46
+		\Storage::delete($path);
47
+	}
48 48
 
49
-    /**
50
-     * Save the given image.
51
-     * 
52
-     * @param  object  $image
53
-     * @param  string  $dir
54
-     * @return string
55
-     */
56
-    protected function saveImage($image, $dir) 
57
-    {
58
-        $imageName = 'image'.uniqid().time().'.jpg';
59
-        $path      = 'public'.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR.$imageName;
60
-        \Storage::put($path, $image->stream());
49
+	/**
50
+	 * Save the given image.
51
+	 * 
52
+	 * @param  object  $image
53
+	 * @param  string  $dir
54
+	 * @return string
55
+	 */
56
+	protected function saveImage($image, $dir) 
57
+	{
58
+		$imageName = 'image'.uniqid().time().'.jpg';
59
+		$path      = 'public'.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR.$imageName;
60
+		\Storage::put($path, $image->stream());
61 61
 
62
-        return $path;
63
-    }
62
+		return $path;
63
+	}
64 64
 }
Please login to merge, or discard this patch.
src/Modules/Core/Utl/ErrorHandler.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -104,11 +104,11 @@
 block discarded – undo
104 104
 		abort($error['status'], $error['message']);
105 105
 	}
106 106
 
107
-    public function invalidConfirmationCode()
108
-    {
109
-        $error = ['status' => 400, 'message' => trans('core::errors.invalidConfirmationCode')];
110
-        abort($error['status'], $error['message']);
111
-    }
107
+	public function invalidConfirmationCode()
108
+	{
109
+		$error = ['status' => 400, 'message' => trans('core::errors.invalidConfirmationCode')];
110
+		abort($error['status'], $error['message']);
111
+	}
112 112
 
113 113
 	public function notFound($text)
114 114
 	{
Please login to merge, or discard this patch.
files/channels.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,5 +12,5 @@
 block discarded – undo
12 12
 */
13 13
 
14 14
 Broadcast::channel('users.{id}', function ($user, $id) {
15
-    return (int) $user->id === (int) $id;
15
+	return (int) $user->id === (int) $id;
16 16
 });
Please login to merge, or discard this patch.