@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | { |
52 | 52 | $userId = $manager->getAuth()->params['userId']; |
53 | 53 | |
54 | - return DeviceToken::where('user_id',$userId)->get(); |
|
54 | + return DeviceToken::where('user_id', $userId)->get(); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | return DeviceToken::where(function($query) use($token) { |
65 | 65 | |
66 | 66 | //where query for token |
67 | - $query->where('token_integer',crc32(md5($token))); |
|
68 | - $query->where('device_agent_integer',crc32(md5($_SERVER['HTTP_USER_AGENT']))); |
|
67 | + $query->where('token_integer', crc32(md5($token))); |
|
68 | + $query->where('device_agent_integer', crc32(md5($_SERVER['HTTP_USER_AGENT']))); |
|
69 | 69 | }); |
70 | 70 | } |
71 | 71 | |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | return DeviceToken::where(function($query) use($token) { |
80 | 80 | |
81 | 81 | //where query for token |
82 | - $query->where('token_integer',crc32(md5($token))); |
|
83 | - $query->where('device_agent_integer',crc32(md5($_SERVER['HTTP_USER_AGENT']))); |
|
82 | + $query->where('token_integer', crc32(md5($token))); |
|
83 | + $query->where('device_agent_integer', crc32(md5($_SERVER['HTTP_USER_AGENT']))); |
|
84 | 84 | |
85 | 85 | }); |
86 | 86 | } |
@@ -91,23 +91,23 @@ discard block |
||
91 | 91 | * @param null|object $query |
92 | 92 | * @return mixed |
93 | 93 | */ |
94 | - protected function checkPasswordVerify($query=null) |
|
94 | + protected function checkPasswordVerify($query = null) |
|
95 | 95 | { |
96 | - if(is_null($query) && isset($this->credentials['password'])){ |
|
97 | - if(!is_null($password = $this->auth->provider('password')) |
|
98 | - && $password($this->credentials['password'])=='verify'){ |
|
96 | + if (is_null($query) && isset($this->credentials['password'])) { |
|
97 | + if (!is_null($password = $this->auth->provider('password')) |
|
98 | + && $password($this->credentials['password'])=='verify') { |
|
99 | 99 | |
100 | 100 | $this->password = $this->credentials['password']; |
101 | 101 | $this->passwordVerify = true; |
102 | - $this->credentials = Arr::removeKey($this->credentials,['password']); |
|
102 | + $this->credentials = Arr::removeKey($this->credentials, ['password']); |
|
103 | 103 | |
104 | 104 | return null; |
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
108 | - if(is_object($query) && $query->count()){ |
|
108 | + if (is_object($query) && $query->count()) { |
|
109 | 109 | $password = $query->first()->password; |
110 | - if(password_verify($this->password,$password)){ |
|
110 | + if (password_verify($this->password, $password)) { |
|
111 | 111 | return $query; |
112 | 112 | } |
113 | 113 | } |
@@ -137,24 +137,24 @@ discard block |
||
137 | 137 | |
138 | 138 | // with the callback method (eloquent model) |
139 | 139 | // we write the where clause. |
140 | - foreach ($this->credentials as $credential=>$credentialValue){ |
|
140 | + foreach ($this->credentials as $credential=>$credentialValue) { |
|
141 | 141 | |
142 | - if(!is_null($provider = $this->auth->provider($credential))){ |
|
143 | - $query->where($credential,$provider($credentialValue)); |
|
142 | + if (!is_null($provider = $this->auth->provider($credential))) { |
|
143 | + $query->where($credential, $provider($credentialValue)); |
|
144 | 144 | } |
145 | - else{ |
|
146 | - $query->where($credential,$credentialValue); |
|
145 | + else { |
|
146 | + $query->where($credential, $credentialValue); |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 | |
150 | 150 | // for the authenticate query, |
151 | 151 | // the user can add additional queries by the service provider. |
152 | - if(!is_null($addQuery = $this->auth->provider('addQuery'))){ |
|
152 | + if (!is_null($addQuery = $this->auth->provider('addQuery'))) { |
|
153 | 153 | $addQuery($query); |
154 | 154 | } |
155 | 155 | }); |
156 | 156 | |
157 | - if(false === $this->passwordVerify){ |
|
157 | + if (false===$this->passwordVerify) { |
|
158 | 158 | return $query; |
159 | 159 | } |
160 | 160 | |
@@ -164,10 +164,10 @@ discard block |
||
164 | 164 | /** |
165 | 165 | * @return void|mixed |
166 | 166 | */ |
167 | - protected function updateToken($token=null) |
|
167 | + protected function updateToken($token = null) |
|
168 | 168 | { |
169 | 169 | //if query status value is true |
170 | - if($this->auth->params['status']){ |
|
170 | + if ($this->auth->params['status']) { |
|
171 | 171 | |
172 | 172 | // we go to the method that produces |
173 | 173 | // the classical token value and get the token value. |
@@ -177,13 +177,13 @@ discard block |
||
177 | 177 | // if there is no update, we reset the status value to 0. |
178 | 178 | $update = $this->auth->params['builder']->update(['token'=>$this->auth->params['token']]); |
179 | 179 | |
180 | - if(!$update){ |
|
180 | + if (!$update) { |
|
181 | 181 | $this->auth->params['status'] = 0; |
182 | 182 | $this->auth->params['exception'] = 'update'; |
183 | 183 | } |
184 | - else{ |
|
185 | - if(!is_null($after = $this->auth->provider('after'))){ |
|
186 | - if(false === $after($this->auth->params['builder']->first())){ |
|
184 | + else { |
|
185 | + if (!is_null($after = $this->auth->provider('after'))) { |
|
186 | + if (false===$after($this->auth->params['builder']->first())) { |
|
187 | 187 | $this->auth->params['status'] = 0; |
188 | 188 | $this->auth->params['exception'] = 'update'; |
189 | 189 | } |
@@ -203,10 +203,10 @@ discard block |
||
203 | 203 | { |
204 | 204 | $token_integer = crc32(md5($this->auth->params['token'])); |
205 | 205 | |
206 | - if(!is_null($token_integer)){ |
|
206 | + if (!is_null($token_integer)) { |
|
207 | 207 | |
208 | - if(DeviceToken::where('user_id',$this->auth->params['authId']) |
|
209 | - ->where('device_agent_integer',crc32(md5($_SERVER['HTTP_USER_AGENT'])))->count()==0){ |
|
208 | + if (DeviceToken::where('user_id', $this->auth->params['authId']) |
|
209 | + ->where('device_agent_integer', crc32(md5($_SERVER['HTTP_USER_AGENT'])))->count()==0) { |
|
210 | 210 | |
211 | 211 | return DeviceToken::create([ |
212 | 212 | 'user_id' => $this->auth->params['authId'], |
@@ -217,10 +217,10 @@ discard block |
||
217 | 217 | 'expire' => $this->auth->getExpire(), |
218 | 218 | ]); |
219 | 219 | } |
220 | - else{ |
|
220 | + else { |
|
221 | 221 | |
222 | - return DeviceToken::where('user_id',$this->auth->params['authId']) |
|
223 | - ->where('device_agent_integer',crc32(md5($_SERVER['HTTP_USER_AGENT']))) |
|
222 | + return DeviceToken::where('user_id', $this->auth->params['authId']) |
|
223 | + ->where('device_agent_integer', crc32(md5($_SERVER['HTTP_USER_AGENT']))) |
|
224 | 224 | ->update([ |
225 | 225 | 'token' => $this->auth->params['token'], |
226 | 226 | 'token_integer' => $token_integer |
@@ -240,11 +240,11 @@ discard block |
||
240 | 240 | { |
241 | 241 | $token_integer = crc32(md5($this->auth->getTokenSentByUser())); |
242 | 242 | |
243 | - if(!is_null($token_integer)){ |
|
243 | + if (!is_null($token_integer)) { |
|
244 | 244 | |
245 | - DeviceToken::where('token_integer',$token_integer)->delete(); |
|
245 | + DeviceToken::where('token_integer', $token_integer)->delete(); |
|
246 | 246 | |
247 | - return (DeviceToken::where('token_integer',$token_integer)->count()) ? false : true; |
|
247 | + return (DeviceToken::where('token_integer', $token_integer)->count()) ? false : true; |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | } |
@@ -141,8 +141,7 @@ discard block |
||
141 | 141 | |
142 | 142 | if(!is_null($provider = $this->auth->provider($credential))){ |
143 | 143 | $query->where($credential,$provider($credentialValue)); |
144 | - } |
|
145 | - else{ |
|
144 | + } else{ |
|
146 | 145 | $query->where($credential,$credentialValue); |
147 | 146 | } |
148 | 147 | } |
@@ -180,8 +179,7 @@ discard block |
||
180 | 179 | if(!$update){ |
181 | 180 | $this->auth->params['status'] = 0; |
182 | 181 | $this->auth->params['exception'] = 'update'; |
183 | - } |
|
184 | - else{ |
|
182 | + } else{ |
|
185 | 183 | if(!is_null($after = $this->auth->provider('after'))){ |
186 | 184 | if(false === $after($this->auth->params['builder']->first())){ |
187 | 185 | $this->auth->params['status'] = 0; |
@@ -216,8 +214,7 @@ discard block |
||
216 | 214 | 'device_agent_integer' => crc32(md5($_SERVER['HTTP_USER_AGENT'])), |
217 | 215 | 'expire' => $this->auth->getExpire(), |
218 | 216 | ]); |
219 | - } |
|
220 | - else{ |
|
217 | + } else{ |
|
221 | 218 | |
222 | 219 | return DeviceToken::where('user_id',$this->auth->params['authId']) |
223 | 220 | ->where('device_agent_integer',crc32(md5($_SERVER['HTTP_USER_AGENT']))) |