【发布时间】:2021-08-17 04:34:12
【问题描述】:
我正在使用带有 Spark 的 Laravel 8。我正在设置 Stripe(通过文档)并遇到了我无法理解的错误。
在终端中,尝试php artisan migrate 我收到以下错误:无法声明类 CreateReceiptsTable,因为该名称已在使用中。
我尝试了php artisan config:cache 和composer dump_autoload,但运气不佳。
这是一个全新的安装,所以我不明白为什么会出现这个错误。
编辑:我尝试过的事情 - php artisan migrate:fresh php artisan migrate:rollback 但没有解决问题。
希望有人能提供帮助。
创建收据表:
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');
}
}
日志详情
"}
[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}
"}
【问题讨论】:
-
这里有一些建议的解决方案:stackoverflow.com/a/54765856/1379025
标签: laravel laravel-spark