SQLSTATE[42S22]: Column not found: 1054 Unknown column 'personal_access_tokens.company_id' in 'where

Hello everyone I recently got acquainted with the Api-service plugin, but I can't solve 1 problem, namely :
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'personal_access_tokens.company_id' in 'where clause'

Tell me how you can fix this problem, here is the code of the Token model :
<?php

namespace Rupadana\ApiService\Models;

use App\Models\Company;
use App\Models\User;
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';
}
image.png
Solution
Did you check your migrations? It says that the company_id field is missing in your table
Was this page helpful?