id(); $table->string('key')->unique(); $table->string('name'); // Which kind of workspace the plan provisions. Free and personal // plans map to a single-user personal workspace, family to a shared // family workspace, and organization to a shared organization. $table->string('workspace_type')->default('personal'); // The Stripe price id the plan is sold against. Plans without one // are not purchasable and are hidden from the pricing page. $table->string('stripe_price')->nullable(); $table->string('interval')->default('month'); // The advertised price, in minor units, so a bad edit cannot // silently advertise a free plan. $table->unsignedInteger('amount')->default(0); // Limits. A null limit means unlimited. $table->unsignedInteger('seat_limit')->nullable(); $table->unsignedInteger('max_folders')->nullable(); $table->unsignedInteger('max_folder_depth')->nullable(); $table->unsignedInteger('max_notes_per_folder')->nullable(); $table->unsignedInteger('note_chars')->nullable(); $table->unsignedInteger('sort_order')->default(0); $table->boolean('is_active')->default(true); $table->timestamps(); }); // The plans that ship with the application. The paid personal plan // reuses the configured Pro price, so it stays in step with the Stripe // product created in the dashboard. $personalPrice = config('plans.plans.pro.price'); $personalPrice = is_string($personalPrice) && $personalPrice !== '' ? $personalPrice : null; $plans = [ [ 'key' => 'free', 'name' => 'Free', 'workspace_type' => 'personal', 'stripe_price' => null, 'amount' => 0, 'seat_limit' => 1, 'max_folders' => 3, 'max_folder_depth' => 1, 'max_notes_per_folder' => 50, 'note_chars' => 1000, 'sort_order' => 0, ], [ 'key' => 'personal', 'name' => 'Personal', 'workspace_type' => 'personal', 'stripe_price' => $personalPrice, 'amount' => 1000, 'seat_limit' => 1, 'max_folders' => null, 'max_folder_depth' => null, 'max_notes_per_folder' => null, 'note_chars' => null, 'sort_order' => 1, ], [ 'key' => 'family', 'name' => 'Family', 'workspace_type' => 'family', 'stripe_price' => null, 'amount' => 2500, 'seat_limit' => 6, 'max_folders' => null, 'max_folder_depth' => null, 'max_notes_per_folder' => null, 'note_chars' => null, 'sort_order' => 2, ], [ 'key' => 'organization', 'name' => 'Organization', 'workspace_type' => 'organization', 'stripe_price' => null, 'amount' => 9900, 'seat_limit' => null, 'max_folders' => null, 'max_folder_depth' => null, 'max_notes_per_folder' => null, 'note_chars' => null, 'sort_order' => 3, ], [ 'key' => 'unlimited', 'name' => 'Unlimited', 'workspace_type' => 'personal', 'stripe_price' => null, 'amount' => 0, 'seat_limit' => 1, 'max_folders' => null, 'max_folder_depth' => null, 'max_notes_per_folder' => null, 'note_chars' => null, 'sort_order' => 4, ], ]; foreach ($plans as $plan) { DB::table('plans')->insert($plan + [ 'interval' => 'month', 'is_active' => true, 'created_at' => now(), 'updated_at' => now(), ]); } } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('plans'); } };