F
Filamentβ€’11mo ago
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';
}
No description
Solution:
Did you check your migrations? It says that the company_id field is missing in your table
Jump to solution
2 Replies
Solution
JJSanders
JJSandersβ€’11mo ago
Did you check your migrations? It says that the company_id field is missing in your table
hxnnxs
hxnnxsOPβ€’11mo ago
Yes, indeed. I was a little stupid.πŸ˜…
Want results from more Discord servers?
Add your server