PHP-056 / Intermediate
Storing API tokens in plaintext
Why is this a problem?
If the DB leaks, all API tokens can be used immediately.
How to fix it
php
$token = $user->createToken('app'); // Sanctum: store the hash; return plaintext only once
return $token->plainTextToken;