SQLSTATE[HY000]: General error: 1364 Field 'tokenable_type' doesn't have a default value

Hello everyone I ran into a problem in the Api-service plugin again. This time the error is :
SQLSTATE[HY000]: General error: 1364 Field 'tokenable_type' doesn't have a default value    

Although the documentation says that everything should be connected automatically, but I still have errors (I assume because of multi-tenancy)
The plugin Model code and other necessary codes are provided below. Token.php (its plugin model) :
 <?php

namespace Rupadana\ApiService\Models;

use App\Models\Company;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Laravel\Sanctum\PersonalAccessToken;

class Token extends PersonalAccessToken
{
    use HasFactory;

    public function company(): BelongsTo
    {
        return $this->belongsTo(Company::class);
    }
    protected $table = 'personal_access_tokens';
}
api-service.php:
<?php

// config for Rupadana/ApiService
return [
    'navigation' => [
        'group' => [
            'token' => 'Company',
        ],
    ],
];
Comapny.php:
<?php

namespace App\Models;
use ...
class Company extends Model
{
    protected  $fillable = [
        'user_id',
        'name',
        'short_name',
        'type',
    ];
    public static array $allowedFields = [
        'name'
    ];

    // Which fields can be used to sort the results through the query string
    public static array $allowedSorts = [
        'name',
        'created_at'
    ];

    // Which fields can be used to filter the results through the query string
    public static array $allowedFilters = [
        'name'
    ];
    public function token(): HasMany
    {
        return $this->hasMany(Token::class);
    }
Was this page helpful?