Completed
Push — master ( c2b02d...e85db7 )
by Sherif
01:51
created
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/Http/Controllers/BaseApiController.php 1 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/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.
src/Modules/Acl/Repositories/UserRepository.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -293,14 +293,14 @@  discard block
 block discarded – undo
293 293
 	 */
294 294
 	public function confirmEmail($confirmationCode)
295 295
 	{
296
-        if ( ! $user = $this->first(['confirmation_code' => $confirmationCode])) 
297
-        {
298
-            \ErrorHandler::invalidConfirmationCode();
299
-        }
300
-
301
-        $user->confirmed         = 1;
302
-        $user->confirmation_code = null;
303
-        $user->save();
296
+		if ( ! $user = $this->first(['confirmation_code' => $confirmationCode])) 
297
+		{
298
+			\ErrorHandler::invalidConfirmationCode();
299
+		}
300
+
301
+		$user->confirmed         = 1;
302
+		$user->confirmation_code = null;
303
+		$user->save();
304 304
 	}
305 305
 
306 306
 	/**
@@ -375,26 +375,26 @@  discard block
 block discarded – undo
375 375
 		$this->save($data);
376 376
 	}
377 377
 
378
-    /**
379
-     * Ensure access token hasn't expired or revoked.
380
-     * 
381
-     * @param  string $accessToken
382
-     * @return boolean
383
-     */
384
-    public function accessTokenExpiredOrRevoked($accessToken)
385
-    {
386
-        $accessTokenId = json_decode($accessToken, true)['id'];
387
-        $accessToken   = \DB::table('oauth_access_tokens')
388
-                ->where('id', $accessTokenId)
389
-                ->first();
378
+	/**
379
+	 * Ensure access token hasn't expired or revoked.
380
+	 * 
381
+	 * @param  string $accessToken
382
+	 * @return boolean
383
+	 */
384
+	public function accessTokenExpiredOrRevoked($accessToken)
385
+	{
386
+		$accessTokenId = json_decode($accessToken, true)['id'];
387
+		$accessToken   = \DB::table('oauth_access_tokens')
388
+				->where('id', $accessTokenId)
389
+				->first();
390 390
         
391
-        if (\Carbon\Carbon::parse($accessToken->expires_at)->isPast() || $accessToken->revoked) 
392
-        {
393
-            return true;
394
-        }
391
+		if (\Carbon\Carbon::parse($accessToken->expires_at)->isPast() || $accessToken->revoked) 
392
+		{
393
+			return true;
394
+		}
395 395
 
396
-        return false;
397
-    }
396
+		return false;
397
+	}
398 398
 
399 399
 	/**
400 400
 	 * Revoke the given access token and all 
Please login to merge, or discard this patch.
src/Modules/Acl/AclUser.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -30,10 +30,10 @@  discard block
 block discarded – undo
30 30
 		return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString();
31 31
 	}
32 32
 
33
-    /**
34
-     * Get the profile picture url.
35
-     * @return string
36
-     */
33
+	/**
34
+	 * Get the profile picture url.
35
+	 * @return string
36
+	 */
37 37
 	public function getProfilePictureAttribute($value)
38 38
 	{
39 39
 		return url(\Storage::url($value));
@@ -89,24 +89,24 @@  discard block
 block discarded – undo
89 89
 	 * 
90 90
 	 * @return array
91 91
 	 */
92
-    public function routeNotificationForFCM()
93
-    {
94
-        $devices = \Core::pushNotificationDevices()->findBy(['user_id' => $this->id]);
95
-        $tokens  = [];
96
-
97
-        foreach ($devices as $device) 
98
-        {
99
-            if (\Core::users()->accessTokenExpiredOrRevoked($device->access_token)) 
100
-            {
101
-                $device->forceDelete();
102
-                continue;
103
-            }
104
-
105
-            $tokens[] = $device->device_token;
106
-        }
107
-
108
-        return $tokens;
109
-    }
92
+	public function routeNotificationForFCM()
93
+	{
94
+		$devices = \Core::pushNotificationDevices()->findBy(['user_id' => $this->id]);
95
+		$tokens  = [];
96
+
97
+		foreach ($devices as $device) 
98
+		{
99
+			if (\Core::users()->accessTokenExpiredOrRevoked($device->access_token)) 
100
+			{
101
+				$device->forceDelete();
102
+				continue;
103
+			}
104
+
105
+			$tokens[] = $device->device_token;
106
+		}
107
+
108
+		return $tokens;
109
+	}
110 110
 
111 111
 	/**
112 112
 	 * The channels the user receives notification broadcasts on.
Please login to merge, or discard this patch.