mardi 29 juin 2021

Laravel Sanctum not generating token if user id data type is string

I want to have string data type user's id in laravel and authenticate via sanctum but when i change user's id data type from bigInteger -> String it causes error while generating token but when i'm using bigInteger it works fine.

How to use string data type in user's id and authenticate via sanctum any help!

error:

Illuminate\Database\QueryException: SQLSTATE[HY000]: General error: 1364 Field 'id' doesn't have a default value (SQL: insert into `personal_access_tokens` (`name`, `token`, `abilities`, `tokenable_id`, `tokenable_type`, `updated_at`, `created_at`) values (apiToken, 3a8d3965b6af9d8d5b9caaa5ae557f69dc63c70ae1777e4f5509734d605b2fa4, ["*"], 5fa6ab1ef3206dd468a74eaf5a35d2bd, App\Models\User, 2021-06-30 06:47:05, 2021-06-30 06:47:05)) in file C:\Laravel\gleecia\vendor\laravel\framework\src\Illuminate\Database\Connection.php on line 692


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire