A Laravel Nova resource tool for sanctum tokens.
metasync-site/sanctum-tokens is a Laravel package for a laravel nova resource tool for sanctum tokens..
It currently has 3 GitHub stars and 24.767 downloads on Packagist (latest version 1.0.2).
Install it with composer require metasync-site/sanctum-tokens.
Discover more Laravel packages by metasync-site
or browse all Laravel packages to compare alternatives.
Last updated
This package allows you to use Sanctum to generate a Personal Access Tokens in Nova.

composer require metasync-site/sanctum-tokens
php artisan vendor:publish --provider="MetasyncSite\SanctumTokens\ToolServiceProvider" --tag="sanctum-tokens-migrations"
php artisan migrate
Register the plugin by adding SanctumTokens::make() to the array of fields in the Nova resource. Make sure the
HasApiTokens trait from the Sanctum package has been added to your model.
use MetasyncSite\SanctumTokens\SanctumTokens;
public function fields(Request $request)
{
return [
SanctumTokens::make(),
];
}
You can hide the reference to the token abilities from the UI by calling the hideAbilities() method on the field.
use MetasyncSite\SanctumTokens\SanctumTokens;
public function fields(Request $request)
{
return [
SanctumTokens::make()->hideAbilities(),
];
}
If you don't want to use the default * token ability you can set your own by simply passing an array of strings to the defaultAbilities() method on the field.
This works well with the the hideAbilities() method if you want to hide the abilities logic from your users.
use MetasyncSite\SanctumTokens\SanctumTokens;
public function fields(Request $request)
{
return [
SanctumTokens::make()->defaultAbilities(['crm', 'cms']),
];
}
Publish the package language files to your application's resources/lang/vendor directory: