adding stuff to override sanctum token, can make them non-auto-incrementing

This commit is contained in:
Brian 2022-07-29 14:15:14 -06:00
parent 2c254b1a3e
commit 2a8eb7013d
Signed by: brian
GPG Key ID: DE1A5390A3B84CD8
2 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,17 @@
<?php
namespace App\Models;
use App\Models\Traits\HasUidTrait;
use Laravel\Sanctum\PersonalAccessToken as SanctumPersonalAccessToken;
class PersonalAccessToken extends SanctumPersonalAccessToken
{
use HasUidTrait;
/** @var string */
protected $keyType = 'string';
/** @var bool */
public $incrementing = false;
}

View File

@ -0,0 +1,31 @@
<?php
namespace App\Providers;
use App\Models\PersonalAccessToken;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Laravel\Sanctum\Sanctum;
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
*
* @var array
*/
protected $policies = [
//...
];
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
$this->registerPolicies();
Sanctum::usePersonalAccessTokenModel(PersonalAccessToken::class);
}
}