Skip to content

Commit

Permalink
update ip if needed on current request
Browse files Browse the repository at this point in the history
  • Loading branch information
MoamenEltouny committed Dec 7, 2023
1 parent 7931149 commit c312e84
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Models/UserDevice.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,13 @@ public function token()
*/
public function refresh()
{
return $this->update(['last_action_at' => now()]);
$data = ['last_action_at' => now()];

if ($this->ip == request()->ip()) {
$data['ip'] = request()->ip();
}

return $this->update($data);
}

/**
Expand Down

0 comments on commit c312e84

Please sign in to comment.