© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
4 replies
hxnnxs

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'
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';
}
<?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
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'shipment_items.organization_id' in 'where cl
FilamentFFilament / ❓┊help
2y ago
Import: Column not found: 1054 Unknown column 'grade' in 'field list'
FilamentFFilament / ❓┊help
2y ago
Import Action - "unknown column '' in `where clause` "
FilamentFFilament / ❓┊help
16mo ago