---
title: "Improving Laravel Sanctum Personal Access Token Performance"
url: https://daily.dev/posts/improving-laravel-sanctum-personal-access-token-performance-wq8foaeps
source_url: https://wearnhardt.com/2020/09/improving-laravel-sanctum-personal-access-token-performance/
type: article
source: "Community Picks"
published: 2024-12-23T22:14:13.259Z
updated: 2024-12-23T22:14:40.526Z
tags: ["performance", "authentication", "php", "laravel"]
reading_time: 3
upvotes: 40
comments: 2
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Improving Laravel Sanctum Personal Access Token Performance

**[Community Picks](https://daily.dev/sources/community)** · 3 min read · 40 upvotes · 2 comments

## Summary

The post discusses an issue with Laravel Sanctum personal access tokens where updating the `last_used_at` column caused a performance bottleneck due to frequent database writes. It provides a solution by creating a custom `PersonalAccessToken` model that overrides the `save()` method to prevent unnecessary writes. The implementation steps include generating the model, modifying the `save()` method, and configuring Sanctum to use the custom model, resulting in improved performance.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://wearnhardt.com/2020/09/improving-laravel-sanctum-personal-access-token-performance/>

## Community discussion

Top comments from developers on daily.dev.

**@shurgith** · 0 upvotes

> 16 de septiembre de 2020

## Similar posts on daily.dev

- [Don’t just attend KubeCon \+ CloudNativeCon, Merge Forward your experience\!](https://daily.dev/posts/don-t-just-attend-kubecon-cloudnativecon-merge-forward-your-experience--l0rpp73x8) · CNCF · 0 upvotes · 0 comments
- [Announcing H2 2026 KCDs](https://daily.dev/posts/announcing-h2-2026-kcds-m96goajm1) · CNCF · 1 upvotes · 0 comments
- [Two months of Open Community Groups](https://daily.dev/posts/two-months-of-open-community-groups-asf52zhbs) · CNCF · 0 upvotes · 0 comments
- [CNCF Unveils Schedule for KubeCon \+ CloudNativeCon Europe 2026](https://daily.dev/posts/cncf-unveils-schedule-for-kubecon-cloudnativecon-europe-2026-ikhcoa5cb) · CNCF · 2 upvotes · 0 comments
- [CNCF Debuts KubeCon \+ CloudNativeCon Japan 2026 Schedule](https://daily.dev/posts/cncf-debuts-kubecon-cloudnativecon-japan-2026-schedule-xp5pyudub) · CNCF · 1 upvotes · 0 comments

---

Tags: [#performance](https://daily.dev/tags/performance), [#authentication](https://daily.dev/tags/authentication), [#php](https://daily.dev/tags/php), [#laravel](https://daily.dev/tags/laravel)

[View this post on daily.dev](https://daily.dev/posts/improving-laravel-sanctum-personal-access-token-performance-wq8foaeps)
