how are you running this update query? Do you have a model for this table?
if so what does (new YourModel)->getTable() give?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I'm updating an old program, created a test database and run the migration. It crashed because of a table name on a foreign id:
$table->boolean('clearance_customer')->default(false);
$table->foreignId('sales_people_id')->constrained();
$table->boolean('active')->default(true);
On the migration the table was named "sales_people", i changed the name of the table to "sales_peoples" including the name of the migration file.
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('sales_peoples', function (Blueprint $table) {
$table->id();
$table->string('fbId');
$table->string('crmId')->nullable();
$table->string('salesId');
$table->string('first_name');
$table->string('last_name');
$table->string('full_name');
$table->string('email');
$table->boolean('active')->default(true);
$table->boolean('send_emails')->default(true);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('sales_peoples');
}
};
Run the migration again and passed. My problem is that now when i run a job that update the sales people, i get an error that the table could not be fund.
Bus::dispatch(new UpdateSalesPeople())
[! Illuminate\Database\QueryException SQLSTATE[42S02]: Base table or view not found: 1146 Table 'test.sales_people' does
n't exist (Connection: mysql, SQL: update `sales_people` set `active` = 0, `sales_people`.`updated_at` = 2025-05-12 11:45
:32).
] Aliasing 'UpdateSalesPeople' to 'App\Jobs\UpdateSalesPeople' for this Tinker session.
Where is the table name being cached?
@dan3460 People is a plural. You should use a singular form on models, e.g. SalesPerson. In fact, Laravel would automatically pluralize it to people, and the resulting table name would be sales_people.
Please or to participate in this conversation.