【发布时间】:2019-12-25 05:46:43
【问题描述】:
我想将默认收银员模型更改为我的自定义模型(用户到公司)
我所做的是
- 将 services.php 的模型更改为 App\Models\Companies\Companies::class
- 将我的 .env 更改为 CASHIER_MODEL=App\Models\Companies\Companies
- 已发布收银员迁移并将表名更改为公司,但
php artisan migrate 仍然会更新收银员的默认模型,即用户
// services.php
'stripe' => [
'model' => App\Models\Companies\Companies::class,
'key' => env('STRIPE_KEY'),
'secret' => env('STRIPE_SECRET'),
'webhook' => [
'secret' => env('STRIPE_WEBHOOK_SECRET'),
'tolerance' => env('STRIPE_WEBHOOK_TOLERANCE', 300),
],
],
CASHIER_MODEL=App\Models\Companies\Companies // on .env
// on migration
public function up()
{
Schema::table('companies', function (Blueprint $table) {
$table->string('stripe_id')->nullable()->collation('utf8mb4_bin')->index();
$table->string('card_brand')->nullable();
$table->string('card_last_four', 4)->nullable();
$table->timestamp('trial_ends_at')->nullable();
});
}
【问题讨论】:
-
你试过了吗?取消 artisan serve 并运行 composer dump-autoload 并再次运行 php artisan serve。
标签: php laravel stripe-payments laravel-cashier