@@ 101-112 (lines=12) @@ | ||
98 | * @param Agent $agent |
|
99 | * @return Device|null |
|
100 | */ |
|
101 | public function findUserDeviceByAgent(Authenticatable $user, Agent $agent) |
|
102 | { |
|
103 | if (!$user->hasDevices()) { |
|
104 | return null; |
|
105 | } |
|
106 | ||
107 | $matching = $user->devices->filter(function ($item) use ($agent) { |
|
108 | return $this->deviceMatch($item, $agent); |
|
109 | })->first(); |
|
110 | ||
111 | return $matching ? $matching : null; |
|
112 | } |
|
113 | ||
114 | /** |
|
115 | * @param Authenticatable $user |
|
@@ 187-198 (lines=12) @@ | ||
184 | * @param Agent $agent |
|
185 | * @return false|Device |
|
186 | */ |
|
187 | public function findDeviceForUser(Authenticatable $user, Agent $agent) |
|
188 | { |
|
189 | if (!$user->hasDevices()) { |
|
190 | return false; |
|
191 | } |
|
192 | ||
193 | $device = $user->devices->filter(function ($item) use ($agent) { |
|
194 | return $this->deviceMatch($item, $agent); |
|
195 | })->first(); |
|
196 | ||
197 | return is_null($device) ? false : $device; |
|
198 | } |
|
199 | ||
200 | /** |
|
201 | * @param Device $device |