have you tried changing the class name to something else? I mean if instead of
class CreateReceiptsTable extends Migration
you write
class CreateReceiptsSecondTable extends Migration
what happens?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi all,
I am using Laravel 8 with Spark. I am in the process of setting up Stripe (through documentation) and reach an error that I am failing to understand.
In the terminal, trying to php artisan migrate I receive the following error: Cannot declare class CreateReceiptsTable, because the name is already in use. If I try to visit the localhost I receive the following errorSQLSTATE[42S02]: Base table or view not found
Things I have tried - php artisan migrate:fresh php artisan migrate:rollback php artisan config:cache and composer dump_autoload however did not address the issue.
Laravel picked up the error, and asked if I would like to run the migration, which I did. Suddenly, all tables became present. Once I login (creating a new user) Illuminate\Database\QueryException SQLSTATE[42S22]: Column not found: 1054 Unknown column 'trial_ends_at' in 'field list' error occurs.
CreateReceiptsTable Migration:
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateReceiptsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('receipts', function (Blueprint $table) {
$table->id();
$table->foreignId('billable_id');
$table->string('billable_type');
$table->unsignedBigInteger('paddle_subscription_id')->nullable()->index();
$table->string('checkout_id');
$table->string('order_id')->unique();
$table->string('amount');
$table->string('tax');
$table->string('currency', 3);
$table->integer('quantity');
$table->string('receipt_url')->unique();
$table->timestamp('paid_at');
$table->timestamps();
$table->index(['billable_id', 'billable_type']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('receipts');
}
}
Log details
"}
[2021-05-29 12:10:04] local.ERROR: Cannot declare class CreateReceiptsTable, because the name is already in use {"exception":"[object] (Symfony\Component\ErrorHandler\Error\FatalError(code: 0): Cannot declare class CreateReceiptsTable, because the name is already in use at /Users/dad/Desktop/projects/Sumpaper/vendor/laravel/spark-stripe/database/migrations/2019_06_03_000003_create_receipts_table.php:7)
[stacktrace]
#0 {main}
"}
Please or to participate in this conversation.