Skip to content

Commit

Permalink
add more fields to the Plan model
Browse files Browse the repository at this point in the history
  • Loading branch information
mortenebak committed Nov 1, 2024
1 parent b872085 commit bbc4edc
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/Models/Plan.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ class Plan extends Model
'slug',
'stripe_id',
'features',
'interval',
'currency',
'price',
'price_description',
'description',
];

public function getFeaturesListAttribute(): array
Expand Down
5 changes: 5 additions & 0 deletions database/factories/PlanFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ public function definition(): array
'slug' => $this->faker->slug,
'stripe_id' => $this->faker->slug,
'features' => $this->faker->sentence,
'interval' => $this->faker->randomElement(['monthly', 'yearly']),
'currency' => $this->faker->currencyCode,
'price' => $this->faker->randomFloat(2, 1, 100),
'price_description' => $this->faker->sentence,
'description' => $this->faker->sentence,
];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?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::table('plans', function (Blueprint $table) {
$table->string('interval')->nullable();
$table->string('currency')->nullable();
$table->string('price')->nullable();
$table->string('price_description')->nullable();
$table->string('description')->nullable();
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('plans', function (Blueprint $table) {
$table->dropColumn('interval');
$table->dropColumn('currency');
$table->dropColumn('price');
$table->dropColumn('price_description');
$table->dropColumn('description');
});
}
};

0 comments on commit bbc4edc

Please sign in to comment.