File: /mnt/data/ghayatcom/ghayatcom-api/database/seeders/SubscriptionSeeder.php
<?php
namespace Database\Seeders;
use App\SubscriptionPlan;
use App\SubscriptionPrice;
use Illuminate\Database\Seeder;
class SubscriptionSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$datas = [
1 => [
'stripe_plan_id' => 'prod_Kv2gb6QOZcqdRG',
'name' => 'Free account',
'description' => 'Free account description',
'created_by' => 1,
],
2 => [
'stripe_plan_id' => 'prod_Kv3Pcyu5Q10blp',
'name' => 'Premium account',
'description' => 'Premium account description',
'created_by' => 1,
],
];
foreach ($datas as $id => $data) {
$row = SubscriptionPlan::firstOrNew([
'id' => $id,
]);
$row->fill($data);
$row->save();
}
$datas = [
1 => [
'plan_id' => 2,
'stripe_price_id' => 'plan_L2bXcrD9mwTTFQ',
'amount' => 5,
'currency_code' => 'EUR',
'interval' => 'month',
'status' => 'active',
'created_by' => 1,
],
2 => [
'plan_id' => 2,
'stripe_price_id' => 'plan_L2bcuIFwzvd39X',
'amount' => 50,
'currency_code' => 'EUR',
'interval' => 'year',
'status' => 'active',
'created_by' => 1,
],
];
foreach ($datas as $id => $data) {
$row = SubscriptionPrice::firstOrNew([
'id' => $id,
]);
$row->fill($data);
$row->save();
}
}
}