Completed
Push — master ( a7be99...859bad )
by Sherif
02:52
created
V1/Notifications/Database/Factories/PushNotificationDeviceFactory.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-$factory->define(App\Modules\V1\Notifications\PushNotificationDevice::class, function (Faker\Generator $faker) {
3
+$factory->define(App\Modules\V1\Notifications\PushNotificationDevice::class, function(Faker\Generator $faker) {
4 4
     return [
5 5
 		'device_token' => $faker->sha1(),
6 6
 		'user_id'      => $faker->randomDigitNotNull(),
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 $factory->define(App\Modules\V1\Notifications\PushNotificationDevice::class, function (Faker\Generator $faker) {
4
-    return [
4
+	return [
5 5
 		'device_token' => $faker->sha1(),
6 6
 		'user_id'      => $faker->randomDigitNotNull(),
7 7
 		'created_at'   => $faker->dateTimeBetween('-1 years', 'now'),
8 8
 		'updated_at'   => $faker->dateTimeBetween('-1 years', 'now')
9
-    ];
9
+	];
10 10
 });
11 11
\ No newline at end of file
Please login to merge, or discard this patch.
Database/Migrations/2016_01_24_111942_push_notifications_devices.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 			$table->unique(array('device_token', 'user_id'));
21 21
 			$table->softDeletes();
22 22
 			$table->timestamps();
23
-        });
23
+		});
24 24
 	}
25 25
 
26 26
 	/**
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('push_notifications_devices', function (Blueprint $table) {
15
+		Schema::create('push_notifications_devices', function(Blueprint $table) {
16 16
 			$table->increments('id');
17 17
 			$table->string('device_token');
18 18
 			$table->integer('user_id');
Please login to merge, or discard this patch.
Notifications/Database/Migrations/2017_10_26_154804_create_jobs_table.php 2 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -6,33 +6,33 @@
 block discarded – undo
6 6
 
7 7
 class CreateJobsTable extends Migration
8 8
 {
9
-    /**
10
-     * Run the migrations.
11
-     *
12
-     * @return void
13
-     */
14
-    public function up()
15
-    {
16
-        Schema::create('jobs', function (Blueprint $table) {
17
-            $table->bigIncrements('id');
18
-            $table->string('queue');
19
-            $table->longText('payload');
20
-            $table->tinyInteger('attempts')->unsigned();
21
-            $table->unsignedInteger('reserved_at')->nullable();
22
-            $table->unsignedInteger('available_at');
23
-            $table->unsignedInteger('created_at');
9
+	/**
10
+	 * Run the migrations.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function up()
15
+	{
16
+		Schema::create('jobs', function (Blueprint $table) {
17
+			$table->bigIncrements('id');
18
+			$table->string('queue');
19
+			$table->longText('payload');
20
+			$table->tinyInteger('attempts')->unsigned();
21
+			$table->unsignedInteger('reserved_at')->nullable();
22
+			$table->unsignedInteger('available_at');
23
+			$table->unsignedInteger('created_at');
24 24
 
25
-            $table->index(['queue', 'reserved_at']);
26
-        });
27
-    }
25
+			$table->index(['queue', 'reserved_at']);
26
+		});
27
+	}
28 28
 
29
-    /**
30
-     * Reverse the migrations.
31
-     *
32
-     * @return void
33
-     */
34
-    public function down()
35
-    {
36
-        Schema::dropIfExists('jobs');
37
-    }
29
+	/**
30
+	 * Reverse the migrations.
31
+	 *
32
+	 * @return void
33
+	 */
34
+	public function down()
35
+	{
36
+		Schema::dropIfExists('jobs');
37
+	}
38 38
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
      */
14 14
     public function up()
15 15
     {
16
-        Schema::create('jobs', function (Blueprint $table) {
16
+        Schema::create('jobs', function(Blueprint $table) {
17 17
             $table->bigIncrements('id');
18 18
             $table->string('queue');
19 19
             $table->longText('payload');
Please login to merge, or discard this patch.
src/Modules/V1/Acl/AclUser.php 4 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,6 @@
 block discarded – undo
2 2
 
3 3
 use App\User;
4 4
 use Illuminate\Database\Eloquent\SoftDeletes;
5
-use Illuminate\Notifications\Notifiable;
6 5
 use Laravel\Passport\HasApiTokens;
7 6
 
8 7
 class AclUser extends User {
Please login to merge, or discard this patch.
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -7,89 +7,89 @@
 block discarded – undo
7 7
 
8 8
 class AclUser extends User {
9 9
 
10
-    use SoftDeletes, HasApiTokens;
11
-    protected $table    = 'users';
12
-    protected $dates    = ['created_at', 'updated_at', 'deleted_at'];
13
-    protected $hidden   = ['password', 'remember_token','deleted_at'];
14
-    protected $guarded  = ['id'];
15
-    protected $fillable = ['name', 'email', 'password'];
16
-    public $searchable  = ['name', 'email'];
10
+	use SoftDeletes, HasApiTokens;
11
+	protected $table    = 'users';
12
+	protected $dates    = ['created_at', 'updated_at', 'deleted_at'];
13
+	protected $hidden   = ['password', 'remember_token','deleted_at'];
14
+	protected $guarded  = ['id'];
15
+	protected $fillable = ['name', 'email', 'password'];
16
+	public $searchable  = ['name', 'email'];
17 17
     
18
-    public function getCreatedAtAttribute($value)
19
-    {
20
-        return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
21
-    }
18
+	public function getCreatedAtAttribute($value)
19
+	{
20
+		return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
21
+	}
22 22
 
23
-    public function getUpdatedAtAttribute($value)
24
-    {
25
-        return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
26
-    }
23
+	public function getUpdatedAtAttribute($value)
24
+	{
25
+		return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
26
+	}
27 27
 
28
-    public function getDeletedAtAttribute($value)
29
-    {
30
-        return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
31
-    }
28
+	public function getDeletedAtAttribute($value)
29
+	{
30
+		return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
31
+	}
32 32
 
33
-    /**
34
-     * Encrypt the password attribute before
35
-     * saving it in the storage.
36
-     * 
37
-     * @param string $value 
38
-     */
39
-    public function setPasswordAttribute($value)
40
-    {
41
-        $this->attributes['password'] = bcrypt($value);
42
-    }
33
+	/**
34
+	 * Encrypt the password attribute before
35
+	 * saving it in the storage.
36
+	 * 
37
+	 * @param string $value 
38
+	 */
39
+	public function setPasswordAttribute($value)
40
+	{
41
+		$this->attributes['password'] = bcrypt($value);
42
+	}
43 43
 
44
-    public function groups()
45
-    {
46
-        return $this->belongsToMany('\App\Modules\V1\Acl\AclGroup','users_groups','user_id','group_id')->whereNull('users_groups.deleted_at')->withTimestamps();
47
-    }
44
+	public function groups()
45
+	{
46
+		return $this->belongsToMany('\App\Modules\V1\Acl\AclGroup','users_groups','user_id','group_id')->whereNull('users_groups.deleted_at')->withTimestamps();
47
+	}
48 48
 
49
-    /**
50
-     * Return fcm device tokens related to the user.
51
-     * @return array
52
-     */
53
-    public function routeNotificationForFCM()
54
-    {
55
-        $devices = \Core::pushNotificationsDevices()->findBy(['user_id' => $this->id]);
56
-        $tokens  = [];
49
+	/**
50
+	 * Return fcm device tokens related to the user.
51
+	 * @return array
52
+	 */
53
+	public function routeNotificationForFCM()
54
+	{
55
+		$devices = \Core::pushNotificationsDevices()->findBy(['user_id' => $this->id]);
56
+		$tokens  = [];
57 57
 
58
-        foreach ($devices as $device) 
59
-        {
60
-            $accessToken = decrypt($device->access_token);
58
+		foreach ($devices as $device) 
59
+		{
60
+			$accessToken = decrypt($device->access_token);
61 61
 
62
-            try
63
-            {
64
-                if (\Core::users()->accessTokenExpiredOrRevoked($accessToken)) 
65
-                {
66
-                    continue;
67
-                }
62
+			try
63
+			{
64
+				if (\Core::users()->accessTokenExpiredOrRevoked($accessToken)) 
65
+				{
66
+					continue;
67
+				}
68 68
 
69
-                $tokens[] = $device->device_token;
70
-            } 
71
-            catch (\Exception $e) 
72
-            {
73
-                $device->forceDelete();
74
-            }
75
-        }
69
+				$tokens[] = $device->device_token;
70
+			} 
71
+			catch (\Exception $e) 
72
+			{
73
+				$device->forceDelete();
74
+			}
75
+		}
76 76
 
77
-        return $tokens;
78
-    }
77
+		return $tokens;
78
+	}
79 79
 
80
-    /**
81
-     * The channels the user receives notification broadcasts on.
82
-     *
83
-     * @return string
84
-     */
85
-    public function receivesBroadcastNotificationsOn()
86
-    {
87
-        return 'users.' . $this->id;
88
-    }
80
+	/**
81
+	 * The channels the user receives notification broadcasts on.
82
+	 *
83
+	 * @return string
84
+	 */
85
+	public function receivesBroadcastNotificationsOn()
86
+	{
87
+		return 'users.' . $this->id;
88
+	}
89 89
     
90
-    public static function boot()
91
-    {
92
-        parent::boot();
93
-        parent::observe(\App::make('App\Modules\V1\Acl\ModelObservers\AclUserObserver'));
94
-    }
90
+	public static function boot()
91
+	{
92
+		parent::boot();
93
+		parent::observe(\App::make('App\Modules\V1\Acl\ModelObservers\AclUserObserver'));
94
+	}
95 95
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
     use SoftDeletes, HasApiTokens;
11 11
     protected $table    = 'users';
12 12
     protected $dates    = ['created_at', 'updated_at', 'deleted_at'];
13
-    protected $hidden   = ['password', 'remember_token','deleted_at'];
13
+    protected $hidden   = ['password', 'remember_token', 'deleted_at'];
14 14
     protected $guarded  = ['id'];
15 15
     protected $fillable = ['name', 'email', 'password'];
16 16
     public $searchable  = ['name', 'email'];
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
     public function groups()
45 45
     {
46
-        return $this->belongsToMany('\App\Modules\V1\Acl\AclGroup','users_groups','user_id','group_id')->whereNull('users_groups.deleted_at')->withTimestamps();
46
+        return $this->belongsToMany('\App\Modules\V1\Acl\AclGroup', 'users_groups', 'user_id', 'group_id')->whereNull('users_groups.deleted_at')->withTimestamps();
47 47
     }
48 48
 
49 49
     /**
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      */
85 85
     public function receivesBroadcastNotificationsOn()
86 86
     {
87
-        return 'users.' . $this->id;
87
+        return 'users.'.$this->id;
88 88
     }
89 89
     
90 90
     public static function boot()
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,8 +67,7 @@
 block discarded – undo
67 67
                 }
68 68
 
69 69
                 $tokens[] = $device->device_token;
70
-            } 
71
-            catch (\Exception $e) 
70
+            } catch (\Exception $e) 
72 71
             {
73 72
                 $device->forceDelete();
74 73
             }
Please login to merge, or discard this patch.
src/lang/en/errors.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -2,25 +2,25 @@
 block discarded – undo
2 2
 
3 3
 return [
4 4
     
5
-    /**
6
-     * List of error messages used in core module.
7
-     */
8
-    'unAuthorized'           => 'Please login before any action',
9
-    'invalidRefreshToken'    => 'Invalid refresh token',
10
-    'noPermissions'          => 'No permissions',
11
-    'loginFailed'            => 'Wrong mail or password',
12
-    'noSocialEmail'          => 'Couldn\'t retrieve email',
13
-    'userAlreadyRegistered'  => 'User already registered. Please login using email and password',
14
-    'connectionError'        => 'Connection error',
15
-    'redisNotRunning'        => 'Your redis notification server is\'t running',
16
-    'dbQueryError'           => 'Please check the given inputes',
17
-    'cannotCreateSetting'    => 'Can\'t create setting',
18
-    'cannotUpdateSettingKey' => 'Can\'t update setting key',
19
-    'userIsBlocked'          => 'You have been blocked',
20
-    'invalidResetToken'      => 'Reset password token is invalid',
21
-    'invalidResetPassword'   => 'Reset password is invalid',
22
-    'invalidOldPassword'     => 'Old password is invalid',
23
-    'notFound'               => 'The requested :replace not found',
24
-    'generalError'           => 'Something went wrong',
5
+	/**
6
+	 * List of error messages used in core module.
7
+	 */
8
+	'unAuthorized'           => 'Please login before any action',
9
+	'invalidRefreshToken'    => 'Invalid refresh token',
10
+	'noPermissions'          => 'No permissions',
11
+	'loginFailed'            => 'Wrong mail or password',
12
+	'noSocialEmail'          => 'Couldn\'t retrieve email',
13
+	'userAlreadyRegistered'  => 'User already registered. Please login using email and password',
14
+	'connectionError'        => 'Connection error',
15
+	'redisNotRunning'        => 'Your redis notification server is\'t running',
16
+	'dbQueryError'           => 'Please check the given inputes',
17
+	'cannotCreateSetting'    => 'Can\'t create setting',
18
+	'cannotUpdateSettingKey' => 'Can\'t update setting key',
19
+	'userIsBlocked'          => 'You have been blocked',
20
+	'invalidResetToken'      => 'Reset password token is invalid',
21
+	'invalidResetPassword'   => 'Reset password is invalid',
22
+	'invalidOldPassword'     => 'Old password is invalid',
23
+	'notFound'               => 'The requested :replace not found',
24
+	'generalError'           => 'Something went wrong',
25 25
 
26 26
 ];
27 27
\ No newline at end of file
Please login to merge, or discard this patch.
src/lang/ar/errors.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -2,25 +2,25 @@
 block discarded – undo
2 2
 
3 3
 return [
4 4
     
5
-    /**
6
-     * List of error messages used in core module.
7
-     */
8
-    'unAuthorized'           => 'من فضلك قم بتسجيل الدخول',
9
-    'invalidRefreshToken'    => 'رمز التحديث غير صالح',
10
-    'noPermissions'          => 'لا توجد صلاحية',
11
-    'loginFailed'            => 'خطأ في البريد لاكتروني او كلمة المرور',
12
-    'noSocialEmail'          => 'لا يمكن الحصول علي تابريد الاكتروني',
13
-    'userAlreadyRegistered'  => 'المستخد مسجل بالفعل.سجل الدخول بالبريد الاكتروني و كلمة السر',
14
-    'connectionError'        => 'خطأ في الاتصال',
15
-    'redisNotRunning'        => 'سيرفير الاشعارات لايعمل',
16
-    'dbQueryError'           => 'خطا في البيانات',
17
-    'cannotCreateSetting'    => 'لا يمكن اضافة اعدادات',
18
-    'cannotUpdateSettingKey' => 'لا يمكن تعديل اعدادات',
19
-    'userIsBlocked'          => 'لقد تم حظرك',
20
-    'invalidResetToken'      => 'رمز تعديل كلمة المرور خطا',
21
-    'invalidResetPassword'   => 'خطا في نعديل كلمة المرور',
22
-    'invalidOldPassword'     => 'كلمة السر القديمه خطا',
23
-    'notFound'               => 'ال :replace المطلوب غير موجود',
24
-    'generalError'           => 'حدث خطا ما',
5
+	/**
6
+	 * List of error messages used in core module.
7
+	 */
8
+	'unAuthorized'           => 'من فضلك قم بتسجيل الدخول',
9
+	'invalidRefreshToken'    => 'رمز التحديث غير صالح',
10
+	'noPermissions'          => 'لا توجد صلاحية',
11
+	'loginFailed'            => 'خطأ في البريد لاكتروني او كلمة المرور',
12
+	'noSocialEmail'          => 'لا يمكن الحصول علي تابريد الاكتروني',
13
+	'userAlreadyRegistered'  => 'المستخد مسجل بالفعل.سجل الدخول بالبريد الاكتروني و كلمة السر',
14
+	'connectionError'        => 'خطأ في الاتصال',
15
+	'redisNotRunning'        => 'سيرفير الاشعارات لايعمل',
16
+	'dbQueryError'           => 'خطا في البيانات',
17
+	'cannotCreateSetting'    => 'لا يمكن اضافة اعدادات',
18
+	'cannotUpdateSettingKey' => 'لا يمكن تعديل اعدادات',
19
+	'userIsBlocked'          => 'لقد تم حظرك',
20
+	'invalidResetToken'      => 'رمز تعديل كلمة المرور خطا',
21
+	'invalidResetPassword'   => 'خطا في نعديل كلمة المرور',
22
+	'invalidOldPassword'     => 'كلمة السر القديمه خطا',
23
+	'notFound'               => 'ال :replace المطلوب غير موجود',
24
+	'generalError'           => 'حدث خطا ما',
25 25
 
26 26
 ];
27 27
\ No newline at end of file
Please login to merge, or discard this patch.
src/Modules/V1/Acl/Repositories/UserRepository.php 4 patches
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -122,16 +122,13 @@  discard block
 block discarded – undo
122 122
         if ( ! $user = $this->first(['email' => $credentials['email']])) 
123 123
         {
124 124
             \ErrorHandler::loginFailed();
125
-        }
126
-        else if ($adminLogin && $user->groups->pluck('name')->search('Admin', true) === false) 
125
+        } else if ($adminLogin && $user->groups->pluck('name')->search('Admin', true) === false) 
127 126
         {
128 127
             \ErrorHandler::loginFailed();
129
-        }
130
-        else if ( ! $adminLogin && $user->groups->pluck('name')->search('Admin', true) !== false) 
128
+        } else if ( ! $adminLogin && $user->groups->pluck('name')->search('Admin', true) !== false) 
131 129
         {
132 130
             \ErrorHandler::loginFailed();
133
-        }
134
-        else if ($user->blocked)
131
+        } else if ($user->blocked)
135 132
         {
136 133
             \ErrorHandler::userIsBlocked();
137 134
         }
@@ -159,8 +156,7 @@  discard block
 block discarded – undo
159 156
         {
160 157
             $data = ['email' => $user->email, 'password' => ''];
161 158
             return $this->register($data);
162
-        }
163
-        else
159
+        } else
164 160
         {
165 161
             if ( ! \Auth::attempt(['email' => $registeredUser->email, 'password' => '']))
166 162
             {
@@ -198,12 +194,10 @@  discard block
 block discarded – undo
198 194
         if ( ! $this->hasGroup('Admin'))
199 195
         {
200 196
             \ErrorHandler::noPermissions();
201
-        }
202
-        else if (\Auth::id() == $user_id)
197
+        } else if (\Auth::id() == $user_id)
203 198
         {
204 199
             \ErrorHandler::noPermissions();
205
-        }
206
-        else if ($user->groups->pluck('name')->search('Admin', true) !== false) 
200
+        } else if ($user->groups->pluck('name')->search('Admin', true) !== false) 
207 201
         {
208 202
             \ErrorHandler::noPermissions();
209 203
         }
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -259,7 +259,7 @@
 block discarded – undo
259 259
      * Reset the given user's password.
260 260
      *
261 261
      * @param  array  $credentials
262
-     * @return array
262
+     * @return string|null
263 263
      */
264 264
     public function resetPassword($credentials)
265 265
     {
Please login to merge, or discard this patch.
Indentation   +358 added lines, -358 removed lines patch added patch discarded remove patch
@@ -7,369 +7,369 @@
 block discarded – undo
7 7
 
8 8
 class UserRepository extends AbstractRepository
9 9
 {
10
-    /**
11
-     * Return the model full namespace.
12
-     * 
13
-     * @return string
14
-     */
15
-    protected function getModel()
16
-    {
17
-        return 'App\Modules\V1\Acl\AclUser';
18
-    }
19
-
20
-    /**
21
-     * The loginProxy implementation.
22
-     * 
23
-     * @var \App\Modules\V1\Acl\Proxy\LoginProxy
24
-     */
25
-    protected $loginProxy;
26
-
27
-    /**
28
-     * The accessTokenRepository implementation.
29
-     * @var \League\OAuth2\Server\Repositories\AccessTokenRepositoryInterface
30
-     */
31
-    private $accessTokenRepository;
32
-
33
-    public function __construct(LoginProxy $loginProxy, AccessTokenRepositoryInterface $accessTokenRepository)
34
-    {        
35
-        $this->loginProxy            = $loginProxy;
36
-        $this->accessTokenRepository = $accessTokenRepository;
37
-        parent::__construct();
38
-    }
39
-
40
-    /**
41
-     * Return the logged in user account.
42
-     *
43
-     * @param  array   $relations
44
-     * @return boolean
45
-     */
46
-    public function account($relations = [])
47
-    {
48
-        $permissions = [];
49
-        $user        = \Core::users()->find(\Auth::id(), $relations);
50
-        foreach ($user->groups()->get() as $group)
51
-        {
52
-            $group->permissions->each(function ($permission) use (&$permissions){
53
-                $permissions[$permission->model][$permission->id] = $permission->name;
54
-            });
55
-        }
56
-        $user->permissions = $permissions;
57
-
58
-       return $user;
59
-    }
60
-
61
-    /**
62
-     * Check if the logged in user or the given user 
63
-     * has the given permissions on the given model.
64
-     * 
65
-     * @param  string  $nameOfPermission
66
-     * @param  string  $model            
67
-     * @param  boolean $user
68
-     * @return boolean
69
-     */
70
-    public function can($nameOfPermission, $model, $user = false)
71
-    {      
72
-        $user        = $user ?: $this->find(\Auth::id(), ['groups.permissions']);
73
-        $permissions = [];
74
-
75
-        $user->groups->pluck('permissions')->each(function ($permission) use (&$permissions, $model){
76
-            $permissions = array_merge($permissions, $permission->where('model', $model)->pluck('name')->toArray()); 
77
-        });
10
+	/**
11
+	 * Return the model full namespace.
12
+	 * 
13
+	 * @return string
14
+	 */
15
+	protected function getModel()
16
+	{
17
+		return 'App\Modules\V1\Acl\AclUser';
18
+	}
19
+
20
+	/**
21
+	 * The loginProxy implementation.
22
+	 * 
23
+	 * @var \App\Modules\V1\Acl\Proxy\LoginProxy
24
+	 */
25
+	protected $loginProxy;
26
+
27
+	/**
28
+	 * The accessTokenRepository implementation.
29
+	 * @var \League\OAuth2\Server\Repositories\AccessTokenRepositoryInterface
30
+	 */
31
+	private $accessTokenRepository;
32
+
33
+	public function __construct(LoginProxy $loginProxy, AccessTokenRepositoryInterface $accessTokenRepository)
34
+	{        
35
+		$this->loginProxy            = $loginProxy;
36
+		$this->accessTokenRepository = $accessTokenRepository;
37
+		parent::__construct();
38
+	}
39
+
40
+	/**
41
+	 * Return the logged in user account.
42
+	 *
43
+	 * @param  array   $relations
44
+	 * @return boolean
45
+	 */
46
+	public function account($relations = [])
47
+	{
48
+		$permissions = [];
49
+		$user        = \Core::users()->find(\Auth::id(), $relations);
50
+		foreach ($user->groups()->get() as $group)
51
+		{
52
+			$group->permissions->each(function ($permission) use (&$permissions){
53
+				$permissions[$permission->model][$permission->id] = $permission->name;
54
+			});
55
+		}
56
+		$user->permissions = $permissions;
57
+
58
+	   return $user;
59
+	}
60
+
61
+	/**
62
+	 * Check if the logged in user or the given user 
63
+	 * has the given permissions on the given model.
64
+	 * 
65
+	 * @param  string  $nameOfPermission
66
+	 * @param  string  $model            
67
+	 * @param  boolean $user
68
+	 * @return boolean
69
+	 */
70
+	public function can($nameOfPermission, $model, $user = false)
71
+	{      
72
+		$user        = $user ?: $this->find(\Auth::id(), ['groups.permissions']);
73
+		$permissions = [];
74
+
75
+		$user->groups->pluck('permissions')->each(function ($permission) use (&$permissions, $model){
76
+			$permissions = array_merge($permissions, $permission->where('model', $model)->pluck('name')->toArray()); 
77
+		});
78 78
         
79
-        return in_array($nameOfPermission, $permissions);
80
-    }
81
-
82
-    /**
83
-     * Check if the logged in user has the given group.
84
-     * 
85
-     * @param  string  $groupName
86
-     * @param  integer $userId
87
-     * @return boolean
88
-     */
89
-    public function hasGroup($groupName, $userId = false)
90
-    {
91
-        $userId = $userId ?: \Auth::id();
92
-        $groups = $this->find($userId)->groups;
93
-        return $groups->pluck('name')->search($groupName, true) === false ? false : true;
94
-    }
95
-
96
-    /**
97
-     * Assign the given group ids to the given user.
98
-     * 
99
-     * @param  integer $user_id    
100
-     * @param  array   $group_ids
101
-     * @return object
102
-     */
103
-    public function assignGroups($user_id, $group_ids)
104
-    {
105
-        \DB::transaction(function () use ($user_id, $group_ids) {
106
-            $user = $this->find($user_id);
107
-            $user->groups()->detach();
108
-            $user->groups()->attach($group_ids);
109
-        });
110
-
111
-        return $this->find($user_id);
112
-    }
113
-
114
-    /**
115
-     * Handle a login request to the application.
116
-     * 
117
-     * @param  array   $credentials    
118
-     * @param  boolean $adminLogin
119
-     * @return object
120
-     */
121
-    public function login($credentials, $adminLogin = false)
122
-    {
123
-        if ( ! $user = $this->first(['email' => $credentials['email']])) 
124
-        {
125
-            \ErrorHandler::loginFailed();
126
-        }
127
-        else if ($adminLogin && $user->groups->pluck('name')->search('Admin', true) === false) 
128
-        {
129
-            \ErrorHandler::loginFailed();
130
-        }
131
-        else if ( ! $adminLogin && $user->groups->pluck('name')->search('Admin', true) !== false) 
132
-        {
133
-            \ErrorHandler::loginFailed();
134
-        }
135
-        else if ($user->blocked)
136
-        {
137
-            \ErrorHandler::userIsBlocked();
138
-        }
139
-
140
-        return $user;
141
-    }
142
-
143
-    /**
144
-     * Handle a social login request of the none admin to the application.
145
-     * 
146
-     * @param  array   $credentials
147
-     * @return array
148
-     */
149
-    public function loginSocial($credentials)
150
-    {
151
-        $access_token = $credentials['auth_code'] ? \Socialite::driver($credentials['type'])->getAccessToken($credentials['auth_code']) : $credentials['access_token'];
152
-        $user         = \Socialite::driver($credentials['type'])->userFromToken($access_token);
153
-
154
-        if ( ! $user->email)
155
-        {
156
-            \ErrorHandler::noSocialEmail();
157
-        }
158
-
159
-        if ( ! $registeredUser = $this->model->where('email', $user->email)->first()) 
160
-        {
161
-            $data = ['email' => $user->email, 'password' => ''];
162
-            return $this->register($data);
163
-        }
164
-        else
165
-        {
166
-            if ( ! \Auth::attempt(['email' => $registeredUser->email, 'password' => '']))
167
-            {
168
-                \ErrorHandler::userAlreadyRegistered();
169
-            }
170
-
171
-            return $this->loginProxy->login(['email' => $registeredUser->email, 'password' => ''], 0);
172
-        }
173
-    }
79
+		return in_array($nameOfPermission, $permissions);
80
+	}
81
+
82
+	/**
83
+	 * Check if the logged in user has the given group.
84
+	 * 
85
+	 * @param  string  $groupName
86
+	 * @param  integer $userId
87
+	 * @return boolean
88
+	 */
89
+	public function hasGroup($groupName, $userId = false)
90
+	{
91
+		$userId = $userId ?: \Auth::id();
92
+		$groups = $this->find($userId)->groups;
93
+		return $groups->pluck('name')->search($groupName, true) === false ? false : true;
94
+	}
95
+
96
+	/**
97
+	 * Assign the given group ids to the given user.
98
+	 * 
99
+	 * @param  integer $user_id    
100
+	 * @param  array   $group_ids
101
+	 * @return object
102
+	 */
103
+	public function assignGroups($user_id, $group_ids)
104
+	{
105
+		\DB::transaction(function () use ($user_id, $group_ids) {
106
+			$user = $this->find($user_id);
107
+			$user->groups()->detach();
108
+			$user->groups()->attach($group_ids);
109
+		});
110
+
111
+		return $this->find($user_id);
112
+	}
113
+
114
+	/**
115
+	 * Handle a login request to the application.
116
+	 * 
117
+	 * @param  array   $credentials    
118
+	 * @param  boolean $adminLogin
119
+	 * @return object
120
+	 */
121
+	public function login($credentials, $adminLogin = false)
122
+	{
123
+		if ( ! $user = $this->first(['email' => $credentials['email']])) 
124
+		{
125
+			\ErrorHandler::loginFailed();
126
+		}
127
+		else if ($adminLogin && $user->groups->pluck('name')->search('Admin', true) === false) 
128
+		{
129
+			\ErrorHandler::loginFailed();
130
+		}
131
+		else if ( ! $adminLogin && $user->groups->pluck('name')->search('Admin', true) !== false) 
132
+		{
133
+			\ErrorHandler::loginFailed();
134
+		}
135
+		else if ($user->blocked)
136
+		{
137
+			\ErrorHandler::userIsBlocked();
138
+		}
139
+
140
+		return $user;
141
+	}
142
+
143
+	/**
144
+	 * Handle a social login request of the none admin to the application.
145
+	 * 
146
+	 * @param  array   $credentials
147
+	 * @return array
148
+	 */
149
+	public function loginSocial($credentials)
150
+	{
151
+		$access_token = $credentials['auth_code'] ? \Socialite::driver($credentials['type'])->getAccessToken($credentials['auth_code']) : $credentials['access_token'];
152
+		$user         = \Socialite::driver($credentials['type'])->userFromToken($access_token);
153
+
154
+		if ( ! $user->email)
155
+		{
156
+			\ErrorHandler::noSocialEmail();
157
+		}
158
+
159
+		if ( ! $registeredUser = $this->model->where('email', $user->email)->first()) 
160
+		{
161
+			$data = ['email' => $user->email, 'password' => ''];
162
+			return $this->register($data);
163
+		}
164
+		else
165
+		{
166
+			if ( ! \Auth::attempt(['email' => $registeredUser->email, 'password' => '']))
167
+			{
168
+				\ErrorHandler::userAlreadyRegistered();
169
+			}
170
+
171
+			return $this->loginProxy->login(['email' => $registeredUser->email, 'password' => ''], 0);
172
+		}
173
+	}
174 174
     
175
-    /**
176
-     * Handle a registration request.
177
-     * 
178
-     * @param  array $credentials
179
-     * @return array
180
-     */
181
-    public function register($credentials)
182
-    {
183
-        $this->model->create($credentials);
184
-        return $this->loginProxy->login($credentials, 0);
185
-    }
186
-
187
-    /**
188
-     * Block the user.
189
-     *
190
-     * @param  integer $user_id
191
-     * @return object
192
-     */
193
-    public function block($user_id)
194
-    {
195
-        if ( ! $user = $this->find($user_id)) 
196
-        {
197
-            \ErrorHandler::notFound('user');
198
-        }
199
-        if ( ! $this->hasGroup('Admin'))
200
-        {
201
-            \ErrorHandler::noPermissions();
202
-        }
203
-        else if (\Auth::id() == $user_id)
204
-        {
205
-            \ErrorHandler::noPermissions();
206
-        }
207
-        else if ($user->groups->pluck('name')->search('Admin', true) !== false) 
208
-        {
209
-            \ErrorHandler::noPermissions();
210
-        }
211
-
212
-        $user->blocked = 1;
213
-        $user->save();
175
+	/**
176
+	 * Handle a registration request.
177
+	 * 
178
+	 * @param  array $credentials
179
+	 * @return array
180
+	 */
181
+	public function register($credentials)
182
+	{
183
+		$this->model->create($credentials);
184
+		return $this->loginProxy->login($credentials, 0);
185
+	}
186
+
187
+	/**
188
+	 * Block the user.
189
+	 *
190
+	 * @param  integer $user_id
191
+	 * @return object
192
+	 */
193
+	public function block($user_id)
194
+	{
195
+		if ( ! $user = $this->find($user_id)) 
196
+		{
197
+			\ErrorHandler::notFound('user');
198
+		}
199
+		if ( ! $this->hasGroup('Admin'))
200
+		{
201
+			\ErrorHandler::noPermissions();
202
+		}
203
+		else if (\Auth::id() == $user_id)
204
+		{
205
+			\ErrorHandler::noPermissions();
206
+		}
207
+		else if ($user->groups->pluck('name')->search('Admin', true) !== false) 
208
+		{
209
+			\ErrorHandler::noPermissions();
210
+		}
211
+
212
+		$user->blocked = 1;
213
+		$user->save();
214 214
         
215
-        return $user;
216
-    }
217
-
218
-    /**
219
-     * Unblock the user.
220
-     *
221
-     * @param  integer $user_id
222
-     * @return object
223
-     */
224
-    public function unblock($user_id)
225
-    {
226
-        if ( ! $this->hasGroup('Admin'))
227
-        {
228
-            \ErrorHandler::noPermissions();
229
-        }
230
-
231
-        $user          = $this->find($user_id);
232
-        $user->blocked = 0;
233
-        $user->save();
234
-
235
-        return $user;
236
-    }
237
-
238
-    /**
239
-     * Send a reset link to the given user.
240
-     *
241
-     * @param  string  $email
242
-     * @return void
243
-     */
244
-    public function sendReset($email)
245
-    {
246
-        if ( ! $user = $this->model->where('email', $email)->first())
247
-        {
248
-            \ErrorHandler::notFound('email');
249
-        }
250
-
251
-        $url   = $this->config['resetLink'];
252
-        $token = \Password::getRepository()->create($user);
215
+		return $user;
216
+	}
217
+
218
+	/**
219
+	 * Unblock the user.
220
+	 *
221
+	 * @param  integer $user_id
222
+	 * @return object
223
+	 */
224
+	public function unblock($user_id)
225
+	{
226
+		if ( ! $this->hasGroup('Admin'))
227
+		{
228
+			\ErrorHandler::noPermissions();
229
+		}
230
+
231
+		$user          = $this->find($user_id);
232
+		$user->blocked = 0;
233
+		$user->save();
234
+
235
+		return $user;
236
+	}
237
+
238
+	/**
239
+	 * Send a reset link to the given user.
240
+	 *
241
+	 * @param  string  $email
242
+	 * @return void
243
+	 */
244
+	public function sendReset($email)
245
+	{
246
+		if ( ! $user = $this->model->where('email', $email)->first())
247
+		{
248
+			\ErrorHandler::notFound('email');
249
+		}
250
+
251
+		$url   = $this->config['resetLink'];
252
+		$token = \Password::getRepository()->create($user);
253 253
         
254
-        \Mail::send('acl::resetpassword', ['user' => $user, 'url' => $url, 'token' => $token], function ($m) use ($user) {
255
-            $m->to($user->email, $user->name)->subject('Your Password Reset Link');
256
-        });
257
-    }
258
-
259
-    /**
260
-     * Reset the given user's password.
261
-     *
262
-     * @param  array  $credentials
263
-     * @return array
264
-     */
265
-    public function resetPassword($credentials)
266
-    {
267
-        $response = \Password::reset($credentials, function ($user, $password) {
268
-            $user->password = $password;
269
-            $user->save();
270
-        });
271
-
272
-        switch ($response) {
273
-            case \Password::PASSWORD_RESET:
274
-                return 'success';
254
+		\Mail::send('acl::resetpassword', ['user' => $user, 'url' => $url, 'token' => $token], function ($m) use ($user) {
255
+			$m->to($user->email, $user->name)->subject('Your Password Reset Link');
256
+		});
257
+	}
258
+
259
+	/**
260
+	 * Reset the given user's password.
261
+	 *
262
+	 * @param  array  $credentials
263
+	 * @return array
264
+	 */
265
+	public function resetPassword($credentials)
266
+	{
267
+		$response = \Password::reset($credentials, function ($user, $password) {
268
+			$user->password = $password;
269
+			$user->save();
270
+		});
271
+
272
+		switch ($response) {
273
+			case \Password::PASSWORD_RESET:
274
+				return 'success';
275 275
                 
276
-            case \Password::INVALID_TOKEN:
277
-                \ErrorHandler::invalidResetToken('token');
278
-
279
-            case \Password::INVALID_PASSWORD:
280
-                \ErrorHandler::invalidResetPassword('email');
281
-
282
-            case \Password::INVALID_USER:
283
-                \ErrorHandler::notFound('user');
284
-
285
-            default:
286
-                \ErrorHandler::generalError();
287
-        }
288
-    }
289
-
290
-    /**
291
-     * Change the logged in user password.
292
-     *
293
-     * @param  array  $credentials
294
-     * @return void
295
-     */
296
-    public function changePassword($credentials)
297
-    {
298
-        $user = \Auth::user();
299
-        if ( ! \Hash::check($credentials['old_password'], $user->password)) 
300
-        {
301
-            \ErrorHandler::invalidOldPassword();
302
-        }
303
-
304
-        $user->password = $credentials['password'];
305
-        $user->save();
306
-    }
307
-
308
-    /**
309
-     * Paginate all users in the given group based on the given conditions.
310
-     * 
311
-     * @param  string  $groupName
312
-     * @param  array   $relations
313
-     * @param  integer $perPage
314
-     * @param  string  $sortBy
315
-     * @param  boolean $desc
316
-     * @return \Illuminate\Http\Response
317
-     */
318
-    public function group($conditions, $groupName, $relations, $perPage, $sortBy, $desc)
319
-    {   
320
-        unset($conditions['page']);
321
-        $conditions = $this->constructConditions($conditions, $this->model);
322
-        $sort       = $desc ? 'desc' : 'asc';
323
-        $model      = call_user_func_array("{$this->getModel()}::with", array($relations));
324
-
325
-        $model->whereHas('groups', function($q) use ($groupName){
326
-            $q->where('name', $groupName);
327
-        });
276
+			case \Password::INVALID_TOKEN:
277
+				\ErrorHandler::invalidResetToken('token');
278
+
279
+			case \Password::INVALID_PASSWORD:
280
+				\ErrorHandler::invalidResetPassword('email');
281
+
282
+			case \Password::INVALID_USER:
283
+				\ErrorHandler::notFound('user');
284
+
285
+			default:
286
+				\ErrorHandler::generalError();
287
+		}
288
+	}
289
+
290
+	/**
291
+	 * Change the logged in user password.
292
+	 *
293
+	 * @param  array  $credentials
294
+	 * @return void
295
+	 */
296
+	public function changePassword($credentials)
297
+	{
298
+		$user = \Auth::user();
299
+		if ( ! \Hash::check($credentials['old_password'], $user->password)) 
300
+		{
301
+			\ErrorHandler::invalidOldPassword();
302
+		}
303
+
304
+		$user->password = $credentials['password'];
305
+		$user->save();
306
+	}
307
+
308
+	/**
309
+	 * Paginate all users in the given group based on the given conditions.
310
+	 * 
311
+	 * @param  string  $groupName
312
+	 * @param  array   $relations
313
+	 * @param  integer $perPage
314
+	 * @param  string  $sortBy
315
+	 * @param  boolean $desc
316
+	 * @return \Illuminate\Http\Response
317
+	 */
318
+	public function group($conditions, $groupName, $relations, $perPage, $sortBy, $desc)
319
+	{   
320
+		unset($conditions['page']);
321
+		$conditions = $this->constructConditions($conditions, $this->model);
322
+		$sort       = $desc ? 'desc' : 'asc';
323
+		$model      = call_user_func_array("{$this->getModel()}::with", array($relations));
324
+
325
+		$model->whereHas('groups', function($q) use ($groupName){
326
+			$q->where('name', $groupName);
327
+		});
328 328
 
329 329
         
330
-        if (count($conditions['conditionValues']))
331
-        {
332
-            $model->whereRaw($conditions['conditionString'], $conditions['conditionValues']);
333
-        }
334
-
335
-        if ($perPage) 
336
-        {
337
-            return $model->orderBy($sortBy, $sort)->paginate($perPage);
338
-        }
339
-
340
-        return $model->orderBy($sortBy, $sort)->get();
341
-    }
342
-
343
-    /**
344
-     * Save the given data to the logged in user.
345
-     *
346
-     * @param  array $credentials
347
-     * @return object
348
-     */
349
-    public function saveProfile($credentials) 
350
-    {
351
-        $user = \Auth::user();
352
-        $user->save($credentials);
353
-
354
-        return $user;
355
-    }
356
-
357
-    /**
358
-     * Ensure access token hasn't expired or revoked.
359
-     * 
360
-     * @param  string $accessToken
361
-     * @return boolean
362
-     */
363
-    public function accessTokenExpiredOrRevoked($accessToken)
364
-    {
365
-        $data = new ValidationData();
366
-        $data->setCurrentTime(time());
367
-
368
-        if ($accessToken->validate($data) === false || $this->accessTokenRepository->isAccessTokenRevoked($accessToken->getClaim('jti'))) 
369
-        {
370
-            return true;
371
-        }
372
-
373
-        return false;
374
-    }
330
+		if (count($conditions['conditionValues']))
331
+		{
332
+			$model->whereRaw($conditions['conditionString'], $conditions['conditionValues']);
333
+		}
334
+
335
+		if ($perPage) 
336
+		{
337
+			return $model->orderBy($sortBy, $sort)->paginate($perPage);
338
+		}
339
+
340
+		return $model->orderBy($sortBy, $sort)->get();
341
+	}
342
+
343
+	/**
344
+	 * Save the given data to the logged in user.
345
+	 *
346
+	 * @param  array $credentials
347
+	 * @return object
348
+	 */
349
+	public function saveProfile($credentials) 
350
+	{
351
+		$user = \Auth::user();
352
+		$user->save($credentials);
353
+
354
+		return $user;
355
+	}
356
+
357
+	/**
358
+	 * Ensure access token hasn't expired or revoked.
359
+	 * 
360
+	 * @param  string $accessToken
361
+	 * @return boolean
362
+	 */
363
+	public function accessTokenExpiredOrRevoked($accessToken)
364
+	{
365
+		$data = new ValidationData();
366
+		$data->setCurrentTime(time());
367
+
368
+		if ($accessToken->validate($data) === false || $this->accessTokenRepository->isAccessTokenRevoked($accessToken->getClaim('jti'))) 
369
+		{
370
+			return true;
371
+		}
372
+
373
+		return false;
374
+	}
375 375
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         $user        = \Core::users()->find(\Auth::id(), $relations);
50 50
         foreach ($user->groups()->get() as $group)
51 51
         {
52
-            $group->permissions->each(function ($permission) use (&$permissions){
52
+            $group->permissions->each(function($permission) use (&$permissions){
53 53
                 $permissions[$permission->model][$permission->id] = $permission->name;
54 54
             });
55 55
         }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
         $user        = $user ?: $this->find(\Auth::id(), ['groups.permissions']);
73 73
         $permissions = [];
74 74
 
75
-        $user->groups->pluck('permissions')->each(function ($permission) use (&$permissions, $model){
75
+        $user->groups->pluck('permissions')->each(function($permission) use (&$permissions, $model){
76 76
             $permissions = array_merge($permissions, $permission->where('model', $model)->pluck('name')->toArray()); 
77 77
         });
78 78
         
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
      */
103 103
     public function assignGroups($user_id, $group_ids)
104 104
     {
105
-        \DB::transaction(function () use ($user_id, $group_ids) {
105
+        \DB::transaction(function() use ($user_id, $group_ids) {
106 106
             $user = $this->find($user_id);
107 107
             $user->groups()->detach();
108 108
             $user->groups()->attach($group_ids);
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
         $url   = $this->config['resetLink'];
252 252
         $token = \Password::getRepository()->create($user);
253 253
         
254
-        \Mail::send('acl::resetpassword', ['user' => $user, 'url' => $url, 'token' => $token], function ($m) use ($user) {
254
+        \Mail::send('acl::resetpassword', ['user' => $user, 'url' => $url, 'token' => $token], function($m) use ($user) {
255 255
             $m->to($user->email, $user->name)->subject('Your Password Reset Link');
256 256
         });
257 257
     }
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
      */
265 265
     public function resetPassword($credentials)
266 266
     {
267
-        $response = \Password::reset($credentials, function ($user, $password) {
267
+        $response = \Password::reset($credentials, function($user, $password) {
268 268
             $user->password = $password;
269 269
             $user->save();
270 270
         });
Please login to merge, or discard this patch.
src/Modules/V1/Acl/Repositories/OauthClientRepository.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -14,27 +14,27 @@
 block discarded – undo
14 14
 		return 'App\Modules\V1\Acl\OauthClient';
15 15
 	}
16 16
 
17
-    /**
18
-     * Revoke the given client.
19
-     *
20
-     * @param  integer  $clientId
21
-     * @return void
22
-     */
23
-    public function revoke($clientId)
24
-    {
25
-    	$client = $this->find($clientId);
26
-        $client->tokens()->update(['revoked' => true]);
27
-        $client->forceFill(['revoked' => true])->save();
28
-    }
17
+	/**
18
+	 * Revoke the given client.
19
+	 *
20
+	 * @param  integer  $clientId
21
+	 * @return void
22
+	 */
23
+	public function revoke($clientId)
24
+	{
25
+		$client = $this->find($clientId);
26
+		$client->tokens()->update(['revoked' => true]);
27
+		$client->forceFill(['revoked' => true])->save();
28
+	}
29 29
 
30
-    /**
31
-     * Revoke the given client.
32
-     *
33
-     * @param  integer  $clientId
34
-     * @return void
35
-     */
36
-    public function revoke($clientId)
37
-    {
30
+	/**
31
+	 * Revoke the given client.
32
+	 *
33
+	 * @param  integer  $clientId
34
+	 * @return void
35
+	 */
36
+	public function revoke($clientId)
37
+	{
38 38
 		$this->update($clientId, ['secret' => str_random(40)]);
39
-    }
39
+	}
40 40
 }
Please login to merge, or discard this patch.
src/Modules/V1/Acl/OauthClient.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -6,23 +6,23 @@
 block discarded – undo
6 6
 
7 7
 class OauthClient extends Client
8 8
 {
9
-    protected $dates    = ['created_at', 'updated_at'];
10
-    protected $fillable = ['name', 'redirect', 'user_id', 'personal_access_client', 'password_client', 'revoked'];
11
-    public $searchable  = ['name'];
9
+	protected $dates    = ['created_at', 'updated_at'];
10
+	protected $fillable = ['name', 'redirect', 'user_id', 'personal_access_client', 'password_client', 'revoked'];
11
+	public $searchable  = ['name'];
12 12
     
13
-    public function getCreatedAtAttribute($value)
14
-    {
15
-        return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
16
-    }
13
+	public function getCreatedAtAttribute($value)
14
+	{
15
+		return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
16
+	}
17 17
 
18
-    public function getUpdatedAtAttribute($value)
19
-    {
20
-        return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
21
-    }
18
+	public function getUpdatedAtAttribute($value)
19
+	{
20
+		return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
21
+	}
22 22
     
23
-    public static function boot()
24
-    {
25
-        parent::boot();
26
-        parent::observe(\App::make('App\Modules\V1\Acl\ModelObservers\OauthClientObserver'));
27
-    }
23
+	public static function boot()
24
+	{
25
+		parent::boot();
26
+		parent::observe(\App::make('App\Modules\V1\Acl\ModelObservers\OauthClientObserver'));
27
+	}
28 28
 }
Please login to merge, or discard this patch.