Completed
Push — master ( 45265e...d868f1 )
by Sherif
02:58
created
src/Modules/V1/Core/Settings.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -5,32 +5,32 @@
 block discarded – undo
5 5
 
6 6
 class Settings extends Model{
7 7
 
8
-    use SoftDeletes;
9
-    protected $table    = 'settings';
10
-    protected $dates    = ['created_at', 'updated_at', 'deleted_at'];
11
-    protected $hidden   = ['deleted_at'];
12
-    protected $guarded  = ['id', 'key'];
13
-    protected $fillable = ['name','value'];
14
-    public $searchable  = ['name', 'value', 'key'];
8
+	use SoftDeletes;
9
+	protected $table    = 'settings';
10
+	protected $dates    = ['created_at', 'updated_at', 'deleted_at'];
11
+	protected $hidden   = ['deleted_at'];
12
+	protected $guarded  = ['id', 'key'];
13
+	protected $fillable = ['name','value'];
14
+	public $searchable  = ['name', 'value', 'key'];
15 15
     
16
-    public function getCreatedAtAttribute($value)
17
-    {
18
-        return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
19
-    }
16
+	public function getCreatedAtAttribute($value)
17
+	{
18
+		return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
19
+	}
20 20
 
21
-    public function getUpdatedAtAttribute($value)
22
-    {
23
-        return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
24
-    }
21
+	public function getUpdatedAtAttribute($value)
22
+	{
23
+		return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
24
+	}
25 25
 
26
-    public function getDeletedAtAttribute($value)
27
-    {
28
-        return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
29
-    }
26
+	public function getDeletedAtAttribute($value)
27
+	{
28
+		return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
29
+	}
30 30
 
31
-    public static function boot()
32
-    {
33
-        parent::boot();
34
-        parent::observe(\App::make('App\Modules\V1\Core\ModelObservers\SettingsObserver'));
35
-    }
31
+	public static function boot()
32
+	{
33
+		parent::boot();
34
+		parent::observe(\App::make('App\Modules\V1\Core\ModelObservers\SettingsObserver'));
35
+	}
36 36
 }
Please login to merge, or discard this patch.
src/Modules/V1/Acl/Http/Controllers/GroupsController.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -8,35 +8,35 @@
 block discarded – undo
8 8
 
9 9
 class GroupsController extends BaseApiController
10 10
 {
11
-    /**
12
-     * The name of the model that is used by the base api controller 
13
-     * to preform actions like (add, edit ... etc).
14
-     * @var string
15
-     */
16
-    protected $model               = 'groups';
11
+	/**
12
+	 * The name of the model that is used by the base api controller 
13
+	 * to preform actions like (add, edit ... etc).
14
+	 * @var string
15
+	 */
16
+	protected $model               = 'groups';
17 17
 
18
-    /**
19
-     * The validations rules used by the base api controller
20
-     * to check before add.
21
-     * @var array
22
-     */
23
-    protected $validationRules  = [
24
-    'name' => 'required|string|max:100|unique:groups,name,{id}'
25
-    ];
18
+	/**
19
+	 * The validations rules used by the base api controller
20
+	 * to check before add.
21
+	 * @var array
22
+	 */
23
+	protected $validationRules  = [
24
+	'name' => 'required|string|max:100|unique:groups,name,{id}'
25
+	];
26 26
 
27
-    /**
28
-     * Handle an assign permissions to group request.
29
-     *
30
-     * @param  \Illuminate\Http\Request  $request
31
-     * @return \Illuminate\Http\Response
32
-     */
33
-    public function assignpermissions(Request $request)
34
-    {
35
-        $this->validate($request, [
36
-            'permission_ids' => 'required|exists:permissions,id', 
37
-            'group_id'       => 'required|array|exists:groups,id'
38
-            ]);
27
+	/**
28
+	 * Handle an assign permissions to group request.
29
+	 *
30
+	 * @param  \Illuminate\Http\Request  $request
31
+	 * @return \Illuminate\Http\Response
32
+	 */
33
+	public function assignpermissions(Request $request)
34
+	{
35
+		$this->validate($request, [
36
+			'permission_ids' => 'required|exists:permissions,id', 
37
+			'group_id'       => 'required|array|exists:groups,id'
38
+			]);
39 39
 
40
-        return \Response::json(\Core::groups()->assignPermissions($request->get('group_id'), $request->get('permission_ids')), 200);
41
-    }
40
+		return \Response::json(\Core::groups()->assignPermissions($request->get('group_id'), $request->get('permission_ids')), 200);
41
+	}
42 42
 }
Please login to merge, or discard this patch.
src/Modules/V1/Acl/Repositories/GroupRepository.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,6 +29,6 @@
 block discarded – undo
29 29
 			$group->permissions()->attach($permission_ids);
30 30
 		});
31 31
 
32
-        return $this->find($group_id);
32
+		return $this->find($group_id);
33 33
 	}
34 34
 }
Please login to merge, or discard this patch.
src/Modules/V1/Core/Interfaces/RepositoryInterface.php 1 patch
Indentation   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -2,119 +2,119 @@
 block discarded – undo
2 2
 
3 3
 interface RepositoryInterface
4 4
 {
5
-    /**
6
-     * Fetch all records with relations from the storage.
7
-     * 
8
-     * @param  array  $relations
9
-     * @param  array  $sortBy
10
-     * @param  array  $desc
11
-     * @param  array  $columns
12
-     * @return collection
13
-     */
14
-    public function all($relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*'));
5
+	/**
6
+	 * Fetch all records with relations from the storage.
7
+	 * 
8
+	 * @param  array  $relations
9
+	 * @param  array  $sortBy
10
+	 * @param  array  $desc
11
+	 * @param  array  $columns
12
+	 * @return collection
13
+	 */
14
+	public function all($relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*'));
15 15
     
16
-    /**
17
-     * Fetch all records with relations from storage in pages 
18
-     * that matche the given query.
19
-     * 
20
-     * @param  string  $query
21
-     * @param  integer $perPage
22
-     * @param  array   $relations
23
-     * @param  array   $sortBy
24
-     * @param  array   $desc
25
-     * @param  array   $columns
26
-     * @return collection
27
-     */
28
-    public function search($query, $perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*'));
16
+	/**
17
+	 * Fetch all records with relations from storage in pages 
18
+	 * that matche the given query.
19
+	 * 
20
+	 * @param  string  $query
21
+	 * @param  integer $perPage
22
+	 * @param  array   $relations
23
+	 * @param  array   $sortBy
24
+	 * @param  array   $desc
25
+	 * @param  array   $columns
26
+	 * @return collection
27
+	 */
28
+	public function search($query, $perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*'));
29 29
 
30
-    /**
31
-     * Fetch all records with relations from storage in pages.
32
-     * 
33
-     * @param  integer $perPage
34
-     * @param  array   $relations
35
-     * @param  array   $sortBy
36
-     * @param  array   $desc
37
-     * @param  array   $columns
38
-     * @return collection
39
-     */
40
-    public function paginate($perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*'));
30
+	/**
31
+	 * Fetch all records with relations from storage in pages.
32
+	 * 
33
+	 * @param  integer $perPage
34
+	 * @param  array   $relations
35
+	 * @param  array   $sortBy
36
+	 * @param  array   $desc
37
+	 * @param  array   $columns
38
+	 * @return collection
39
+	 */
40
+	public function paginate($perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*'));
41 41
     
42
-    /**
43
-     * Fetch all records with relations based on
44
-     * the given condition from storage in pages.
45
-     * 
46
-     * @param  array   $conditions array of conditions
47
-     * @param  integer $perPage
48
-     * @param  array   $relations
49
-     * @param  array   $sortBy
50
-     * @param  array   $desc
51
-     * @param  array   $columns
52
-     * @return collection
53
-     */
54
-    public function paginateBy($conditions, $perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*'));
42
+	/**
43
+	 * Fetch all records with relations based on
44
+	 * the given condition from storage in pages.
45
+	 * 
46
+	 * @param  array   $conditions array of conditions
47
+	 * @param  integer $perPage
48
+	 * @param  array   $relations
49
+	 * @param  array   $sortBy
50
+	 * @param  array   $desc
51
+	 * @param  array   $columns
52
+	 * @return collection
53
+	 */
54
+	public function paginateBy($conditions, $perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*'));
55 55
 
56
-     /**
57
-     * Save the given model/models to the storage.
58
-     * 
59
-     * @param  array   $data
60
-     * @param  boolean $saveLog
61
-     * @return object
62
-     */
63
-    public function save(array $data, $saveLog = true);
56
+	 /**
57
+	  * Save the given model/models to the storage.
58
+	  * 
59
+	  * @param  array   $data
60
+	  * @param  boolean $saveLog
61
+	  * @return object
62
+	  */
63
+	public function save(array $data, $saveLog = true);
64 64
 
65
-    /**
66
-     * Update record in the storage based on the given
67
-     * condition.
68
-     * 
69
-     * @param  var     $value condition value
70
-     * @param  array   $data
71
-     * @param  string  $attribute condition column name
72
-     * @return integer affected rows
73
-     */
74
-    public function update($value, array $data, $attribute = 'id');
65
+	/**
66
+	 * Update record in the storage based on the given
67
+	 * condition.
68
+	 * 
69
+	 * @param  var     $value condition value
70
+	 * @param  array   $data
71
+	 * @param  string  $attribute condition column name
72
+	 * @return integer affected rows
73
+	 */
74
+	public function update($value, array $data, $attribute = 'id');
75 75
 
76
-    /**
77
-     * Delete record from the storage based on the given
78
-     * condition.
79
-     * 
80
-     * @param  var     $value condition value
81
-     * @param  string  $attribute condition column name
82
-     * @return integer affected rows
83
-     */
84
-    public function delete($value, $attribute = 'id');
76
+	/**
77
+	 * Delete record from the storage based on the given
78
+	 * condition.
79
+	 * 
80
+	 * @param  var     $value condition value
81
+	 * @param  string  $attribute condition column name
82
+	 * @return integer affected rows
83
+	 */
84
+	public function delete($value, $attribute = 'id');
85 85
     
86
-    /**
87
-     * Fetch records from the storage based on the given
88
-     * id.
89
-     * 
90
-     * @param  integer $id
91
-     * @param  array   $relations
92
-     * @param  array   $columns
93
-     * @return object
94
-     */
95
-    public function find($id, $relations = [], $columns = array('*'));
86
+	/**
87
+	 * Fetch records from the storage based on the given
88
+	 * id.
89
+	 * 
90
+	 * @param  integer $id
91
+	 * @param  array   $relations
92
+	 * @param  array   $columns
93
+	 * @return object
94
+	 */
95
+	public function find($id, $relations = [], $columns = array('*'));
96 96
     
97
-    /**
98
-     * Fetch records from the storage based on the given
99
-     * condition.
100
-     * 
101
-     * @param  array   $conditions array of conditions
102
-     * @param  array   $relations
103
-     * @param  array   $sortBy
104
-     * @param  array   $desc
105
-     * @param  array   $columns
106
-     * @return collection
107
-     */
108
-    public function findBy($conditions, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*'));
97
+	/**
98
+	 * Fetch records from the storage based on the given
99
+	 * condition.
100
+	 * 
101
+	 * @param  array   $conditions array of conditions
102
+	 * @param  array   $relations
103
+	 * @param  array   $sortBy
104
+	 * @param  array   $desc
105
+	 * @param  array   $columns
106
+	 * @return collection
107
+	 */
108
+	public function findBy($conditions, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*'));
109 109
 
110
-    /**
111
-     * Fetch the first record fro the storage based on the given
112
-     * condition.
113
-     * 
114
-     * @param  array   $conditions array of conditions
115
-     * @param  array   $relations
116
-     * @param  array   $columns
117
-     * @return object
118
-     */
119
-    public function first($conditions, $relations = [], $columns = array('*'));
110
+	/**
111
+	 * Fetch the first record fro the storage based on the given
112
+	 * condition.
113
+	 * 
114
+	 * @param  array   $conditions array of conditions
115
+	 * @param  array   $relations
116
+	 * @param  array   $columns
117
+	 * @return object
118
+	 */
119
+	public function first($conditions, $relations = [], $columns = array('*'));
120 120
 }
121 121
\ No newline at end of file
Please login to merge, or discard this patch.
src/Modules/V1/Notifications/Repositories/NotificationRepository.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -15,23 +15,23 @@
 block discarded – undo
15 15
 	}
16 16
 
17 17
 	/**
18
-     * Set the notification notified to true.
19
-     * 
20
-     * @param  integer  $id
21
-     * @return object
22
-     */
23
-    public function notified($id)
24
-    {
25
-        return $this->save(['id' => $id, 'notified' => 1]);
26
-    }
18
+	 * Set the notification notified to true.
19
+	 * 
20
+	 * @param  integer  $id
21
+	 * @return object
22
+	 */
23
+	public function notified($id)
24
+	{
25
+		return $this->save(['id' => $id, 'notified' => 1]);
26
+	}
27 27
 
28
-    /**
29
-     * Set the notification notified to all.
30
-     * 
31
-     * @return void
32
-     */
33
-    public function notifyAll()
34
-    {
35
-        $this->update(false, ['notified' => 1], 'notified');
36
-    }
28
+	/**
29
+	 * Set the notification notified to all.
30
+	 * 
31
+	 * @return void
32
+	 */
33
+	public function notifyAll()
34
+	{
35
+		$this->update(false, ['notified' => 1], 'notified');
36
+	}
37 37
 }
Please login to merge, or discard this patch.
src/Modules/V1/Core/Utl/ErrorHandler.php 1 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.
src/Modules/V1/Acl/Http/Controllers/UsersController.php 1 patch
Indentation   +180 added lines, -180 removed lines patch added patch discarded remove patch
@@ -7,184 +7,184 @@
 block discarded – undo
7 7
 
8 8
 class UsersController extends BaseApiController
9 9
 {
10
-    /**
11
-     * The name of the model that is used by the base api controller 
12
-     * to preform actions like (add, edit ... etc).
13
-     * @var string
14
-     */
15
-    protected $model               = 'users';
16
-
17
-    /**
18
-     * List of all route actions that the base api controller
19
-     * will skip permissions check for them.
20
-     * @var array
21
-     */
22
-    protected $skipPermissionCheck = ['account', 'logout', 'sendreset'];
23
-
24
-    /**
25
-     * List of all route actions that the base api controller
26
-     * will skip login check for them.
27
-     * @var array
28
-     */
29
-    protected $skipLoginCheck      = ['login', 'loginSocial', 'register', 'sendreset', 'resetpassword', 'refreshtoken'];
30
-
31
-    /**
32
-     * The validations rules used by the base api controller
33
-     * to check before add.
34
-     * @var array
35
-     */
36
-    protected $validationRules     = [
37
-    'email'    => 'required|email|unique:users,email,{id}',
38
-    'password' => 'min:6'
39
-    ];
40
-
41
-    /**
42
-     * Return the logged in user account.
43
-     * 
44
-     * @return \Illuminate\Http\Response
45
-     */
46
-    public function account()
47
-    {
48
-       $relations = $this->relations && $this->relations['find'] ? $this->relations['find'] : [];
49
-       return \Response::json(call_user_func_array("\Core::{$this->model}", [])->find(\JWTAuth::parseToken()->authenticate()->id, $relations), 200);
50
-    }
51
-
52
-    /**
53
-     * Block the user.
54
-     *
55
-     * @param  integer  $id
56
-     * @return \Illuminate\Http\Response
57
-     */
58
-    public function block($id)
59
-    {
60
-        return \Response::json(\Core::users()->block($id), 200);
61
-    }
62
-
63
-    /**
64
-     * Unblock the user.
65
-     *
66
-     * @param  integer  $id
67
-     * @return \Illuminate\Http\Response
68
-     */
69
-    public function unblock($id)
70
-    {
71
-        return \Response::json(\Core::users()->unblock($id), 200);
72
-    }
73
-
74
-    /**
75
-     * Logout the user.
76
-     * 
77
-     * @return \Illuminate\Http\Response
78
-     */
79
-    public function logout()
80
-    {
81
-        return \Response::json(\Core::users()->logout(), 200);
82
-    }
83
-
84
-    /**
85
-     * Handle a registration request.
86
-     *
87
-     * @param  \Illuminate\Http\Request  $request
88
-     * @return \Illuminate\Http\Response
89
-     */
90
-    public function register(Request $request)
91
-    {
92
-        $this->validate($request, [
93
-            'email'    => 'required|email|unique:users,email,{id}', 
94
-            'password' => 'required|min:6'
95
-            ]);
96
-
97
-        return \Response::json(\Core::users()->register($request->only('email', 'password')), 200);
98
-    }
99
-
100
-    /**
101
-     * Handle a login request of the none admin to the application.
102
-     *
103
-     * @param  \Illuminate\Http\Request  $request
104
-     * @return \Illuminate\Http\Response
105
-     */
106
-    public function login(Request $request)
107
-    {
108
-        $this->validate($request, [
109
-            'email'    => 'required|email', 
110
-            'password' => 'required|min:6',
111
-            'admin'    => 'boolean'
112
-            ]);
113
-
114
-        return \Response::json(\Core::users()->login($request->only('email', 'password'), $request->get('admin')), 200);
115
-    }
116
-
117
-    /**
118
-     * Handle a social login request of the none admin to the application.
119
-     *
120
-     * @param  \Illuminate\Http\Request  $request
121
-     * @return \Illuminate\Http\Response
122
-     */
123
-    public function loginSocial(Request $request)
124
-    {
125
-        $this->validate($request, [
126
-            'auth_code'    => 'required_without:access_token',
127
-            'access_token' => 'required_without:auth_code',
128
-            'type'         => 'required|in:facebook,google'
129
-            ]);
130
-
131
-        return \Response::json(\Core::users()->loginSocial($request->only('auth_code', 'access_token', 'type')), 200);
132
-    }
133
-
134
-    /**
135
-     * Handle an assign groups to user request.
136
-     *
137
-     * @param  \Illuminate\Http\Request  $request
138
-     * @return \Illuminate\Http\Response
139
-     */
140
-    public function assigngroups(Request $request)
141
-    {
142
-        $this->validate($request, [
143
-            'group_ids' => 'required|exists:groups,id', 
144
-            'user_id'   => 'required|exists:users,id'
145
-            ]);
146
-
147
-        return \Response::json(\Core::users()->assignGroups($request->get('user_id'), $request->get('group_ids')), 200);
148
-    }
149
-
150
-    /**
151
-     * Send a reset link to the given user.
152
-     *
153
-     * @param  \Illuminate\Http\Request  $request
154
-     * @return \Illuminate\Http\Response
155
-     */
156
-    public function sendreset(Request $request)
157
-    {
158
-        $this->validate($request, ['email' => 'required|email', 'url' => 'required|url']);
159
-
160
-        return \Response::json(\Core::users()->sendReset($request->only('email'), $request->get('url')), 200);
161
-    }
162
-
163
-    /**
164
-     * Reset the given user's password.
165
-     *
166
-     * @param  \Illuminate\Http\Request  $request
167
-     * @return \Illuminate\Http\Response
168
-     */
169
-    public function resetpassword(Request $request)
170
-    {
171
-        $this->validate($request, [
172
-            'token'                 => 'required',
173
-            'email'                 => 'required|email',
174
-            'password'              => 'required|confirmed|min:6',
175
-            'password_confirmation' => 'required',
176
-        ]);
177
-
178
-        return \Response::json(\Core::users()->resetPassword($request->only('email', 'password', 'password_confirmation', 'token')), 200);
179
-    }
180
-
181
-    /**
182
-     * Refresh the expired login token.
183
-     *
184
-     * @return \Illuminate\Http\Response
185
-     */
186
-    public function refreshtoken()
187
-    {
188
-        return \Response::json(\Core::users()->refreshtoken(), 200);
189
-    }
10
+	/**
11
+	 * The name of the model that is used by the base api controller 
12
+	 * to preform actions like (add, edit ... etc).
13
+	 * @var string
14
+	 */
15
+	protected $model               = 'users';
16
+
17
+	/**
18
+	 * List of all route actions that the base api controller
19
+	 * will skip permissions check for them.
20
+	 * @var array
21
+	 */
22
+	protected $skipPermissionCheck = ['account', 'logout', 'sendreset'];
23
+
24
+	/**
25
+	 * List of all route actions that the base api controller
26
+	 * will skip login check for them.
27
+	 * @var array
28
+	 */
29
+	protected $skipLoginCheck      = ['login', 'loginSocial', 'register', 'sendreset', 'resetpassword', 'refreshtoken'];
30
+
31
+	/**
32
+	 * The validations rules used by the base api controller
33
+	 * to check before add.
34
+	 * @var array
35
+	 */
36
+	protected $validationRules     = [
37
+	'email'    => 'required|email|unique:users,email,{id}',
38
+	'password' => 'min:6'
39
+	];
40
+
41
+	/**
42
+	 * Return the logged in user account.
43
+	 * 
44
+	 * @return \Illuminate\Http\Response
45
+	 */
46
+	public function account()
47
+	{
48
+	   $relations = $this->relations && $this->relations['find'] ? $this->relations['find'] : [];
49
+	   return \Response::json(call_user_func_array("\Core::{$this->model}", [])->find(\JWTAuth::parseToken()->authenticate()->id, $relations), 200);
50
+	}
51
+
52
+	/**
53
+	 * Block the user.
54
+	 *
55
+	 * @param  integer  $id
56
+	 * @return \Illuminate\Http\Response
57
+	 */
58
+	public function block($id)
59
+	{
60
+		return \Response::json(\Core::users()->block($id), 200);
61
+	}
62
+
63
+	/**
64
+	 * Unblock the user.
65
+	 *
66
+	 * @param  integer  $id
67
+	 * @return \Illuminate\Http\Response
68
+	 */
69
+	public function unblock($id)
70
+	{
71
+		return \Response::json(\Core::users()->unblock($id), 200);
72
+	}
73
+
74
+	/**
75
+	 * Logout the user.
76
+	 * 
77
+	 * @return \Illuminate\Http\Response
78
+	 */
79
+	public function logout()
80
+	{
81
+		return \Response::json(\Core::users()->logout(), 200);
82
+	}
83
+
84
+	/**
85
+	 * Handle a registration request.
86
+	 *
87
+	 * @param  \Illuminate\Http\Request  $request
88
+	 * @return \Illuminate\Http\Response
89
+	 */
90
+	public function register(Request $request)
91
+	{
92
+		$this->validate($request, [
93
+			'email'    => 'required|email|unique:users,email,{id}', 
94
+			'password' => 'required|min:6'
95
+			]);
96
+
97
+		return \Response::json(\Core::users()->register($request->only('email', 'password')), 200);
98
+	}
99
+
100
+	/**
101
+	 * Handle a login request of the none admin to the application.
102
+	 *
103
+	 * @param  \Illuminate\Http\Request  $request
104
+	 * @return \Illuminate\Http\Response
105
+	 */
106
+	public function login(Request $request)
107
+	{
108
+		$this->validate($request, [
109
+			'email'    => 'required|email', 
110
+			'password' => 'required|min:6',
111
+			'admin'    => 'boolean'
112
+			]);
113
+
114
+		return \Response::json(\Core::users()->login($request->only('email', 'password'), $request->get('admin')), 200);
115
+	}
116
+
117
+	/**
118
+	 * Handle a social login request of the none admin to the application.
119
+	 *
120
+	 * @param  \Illuminate\Http\Request  $request
121
+	 * @return \Illuminate\Http\Response
122
+	 */
123
+	public function loginSocial(Request $request)
124
+	{
125
+		$this->validate($request, [
126
+			'auth_code'    => 'required_without:access_token',
127
+			'access_token' => 'required_without:auth_code',
128
+			'type'         => 'required|in:facebook,google'
129
+			]);
130
+
131
+		return \Response::json(\Core::users()->loginSocial($request->only('auth_code', 'access_token', 'type')), 200);
132
+	}
133
+
134
+	/**
135
+	 * Handle an assign groups to user request.
136
+	 *
137
+	 * @param  \Illuminate\Http\Request  $request
138
+	 * @return \Illuminate\Http\Response
139
+	 */
140
+	public function assigngroups(Request $request)
141
+	{
142
+		$this->validate($request, [
143
+			'group_ids' => 'required|exists:groups,id', 
144
+			'user_id'   => 'required|exists:users,id'
145
+			]);
146
+
147
+		return \Response::json(\Core::users()->assignGroups($request->get('user_id'), $request->get('group_ids')), 200);
148
+	}
149
+
150
+	/**
151
+	 * Send a reset link to the given user.
152
+	 *
153
+	 * @param  \Illuminate\Http\Request  $request
154
+	 * @return \Illuminate\Http\Response
155
+	 */
156
+	public function sendreset(Request $request)
157
+	{
158
+		$this->validate($request, ['email' => 'required|email', 'url' => 'required|url']);
159
+
160
+		return \Response::json(\Core::users()->sendReset($request->only('email'), $request->get('url')), 200);
161
+	}
162
+
163
+	/**
164
+	 * Reset the given user's password.
165
+	 *
166
+	 * @param  \Illuminate\Http\Request  $request
167
+	 * @return \Illuminate\Http\Response
168
+	 */
169
+	public function resetpassword(Request $request)
170
+	{
171
+		$this->validate($request, [
172
+			'token'                 => 'required',
173
+			'email'                 => 'required|email',
174
+			'password'              => 'required|confirmed|min:6',
175
+			'password_confirmation' => 'required',
176
+		]);
177
+
178
+		return \Response::json(\Core::users()->resetPassword($request->only('email', 'password', 'password_confirmation', 'token')), 200);
179
+	}
180
+
181
+	/**
182
+	 * Refresh the expired login token.
183
+	 *
184
+	 * @return \Illuminate\Http\Response
185
+	 */
186
+	public function refreshtoken()
187
+	{
188
+		return \Response::json(\Core::users()->refreshtoken(), 200);
189
+	}
190 190
 }
Please login to merge, or discard this patch.
src/Modules/V1/Acl/Http/Controllers/AclBaseController.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,9 +8,9 @@
 block discarded – undo
8 8
 
9 9
 class AclBaseController extends BaseApiController
10 10
 {
11
-    public function __construct()
12
-    {
13
-        \Session::set('group', ucfirst(strtolower(\Request::header('group'))));
14
-        parent::__construct();
15
-    }
11
+	public function __construct()
12
+	{
13
+		\Session::set('group', ucfirst(strtolower(\Request::header('group'))));
14
+		parent::__construct();
15
+	}
16 16
 }
Please login to merge, or discard this patch.
src/Modules/V1/Acl/Repositories/UserRepository.php 1 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.