laravel / sanctum

Laravel Sanctum provides a featherweight authentication system for SPAs and simple APIs.
https://laravel.com/docs/sanctum
MIT License
2.75k stars 296 forks source link

Adding data column to personalAccessToken Table #522

Closed Mohamadalani963 closed 4 months ago

Mohamadalani963 commented 4 months ago

This pull request introduces a new data column to the personal_access_tokens table in Laravel Sanctum. The data column is intended to store additional JSON-encoded information related to personal access tokens. Changes

Migration: Added data column in 2019_12_14_000001_create_personal_access_tokens_table.php.
Model: Updated PersonalAccessToken.php to include data in $fillable and cast it to JSON.
Token Creation: Modified HasApiTokens.php and Contracts/HasApiTokens.php to accept data in createToken method.
Testing: Updated HasApiTokensTest.php to include tests for data attribute.
Factory: Added data attribute in PersonalAccessTokenFactory.php.

Impact

This change allows developers to store additional metadata with personal access tokens, enhancing the flexibility and functionality of token management in Laravel Sanctum.

driesvints commented 4 months ago

We can't do this on a patch release unfortunately as the new column will not be found on existing apps.