Skip to content
This repository has been archived by the owner on Mar 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2 from Tankonyako/Tankonyako-patch-1
Browse files Browse the repository at this point in the history
Fix PersonalAccessToken model:

- add missing attribute casting
- add null safe operator for the `is_current` attribute
  • Loading branch information
alajusticia authored Oct 2, 2023
2 parents 07a09bd + 766b9e9 commit 3b9e644
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Models/PersonalAccessToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class PersonalAccessToken extends SanctumPersonalAccessToken
*/
protected $casts = [
'abilities' => 'json',
'ip_data' => 'json',
'expires_at' => 'datetime',
'last_used_at' => 'datetime',
];
Expand Down Expand Up @@ -137,6 +138,6 @@ public function getLocationAttribute()
*/
public function getIsCurrentAttribute()
{
return $this->id === Request::user()->currentAccessToken()->id;
return $this->id === Request::user()?->currentAccessToken()?->id;
}
}

0 comments on commit 3b9e644

Please sign in to comment.