trypost/database/seeders/PlanSeeder.php
Paulo Castellano 2da15df96c feat: introduce Account entity as billing owner and refactor architecture
- Create Account model as Cashier Billable entity (stripe, plan, subscription)
- Account owns workspaces and has an owner_id (User)
- User belongs to one Account via account_id
- Workspace belongs to Account via account_id, no longer has billing fields
- Remove Brand model entirely (workspaces serve as grouping)
- Rename brand_limit to workspace_limit in plans
- Workspace roles simplified: admin/member/viewer (owner via Account)
- Invites now belong to Account with workspaces JSON array
- Pennant features scope changed from Workspace to Account
- EnsureSubscribed middleware checks Account subscription
- All controllers updated: BillingController, OnboardingController,
  WorkspaceInviteController, SocialController, StripeEventListener
- Frontend: extract GoogleAuthButton component, create WorkspaceRole
  enum for type-safe role checks, fix all views for new architecture
- All 1101 tests passing
2026-04-14 22:22:04 -03:00

88 lines
2.8 KiB
PHP

<?php
declare(strict_types=1);
namespace Database\Seeders;
use App\Enums\Plan\Slug;
use App\Models\Plan;
use Illuminate\Database\Seeder;
class PlanSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$plans = [
[
'slug' => Slug::Starter,
'name' => 'Starter',
'stripe_monthly_price_id' => env('STRIPE_STARTER_MONTHLY'),
'stripe_yearly_price_id' => env('STRIPE_STARTER_YEARLY'),
'monthly_price' => 1900,
'yearly_price' => 19000,
'social_account_limit' => 5,
'member_limit' => 1,
'workspace_limit' => 1,
'ai_images_limit' => 50,
'ai_videos_limit' => 10,
'data_retention_days' => 30,
'sort' => 1,
],
[
'slug' => Slug::Plus,
'name' => 'Plus',
'stripe_monthly_price_id' => env('STRIPE_PLUS_MONTHLY'),
'stripe_yearly_price_id' => env('STRIPE_PLUS_YEARLY'),
'monthly_price' => 2900,
'yearly_price' => 29000,
'social_account_limit' => 10,
'member_limit' => 5,
'workspace_limit' => 5,
'ai_images_limit' => 150,
'ai_videos_limit' => 30,
'data_retention_days' => 60,
'sort' => 2,
],
[
'slug' => Slug::Pro,
'name' => 'Pro',
'stripe_monthly_price_id' => env('STRIPE_PRO_MONTHLY'),
'stripe_yearly_price_id' => env('STRIPE_PRO_YEARLY'),
'monthly_price' => 4900,
'yearly_price' => 49000,
'social_account_limit' => 30,
'member_limit' => 15,
'workspace_limit' => 15,
'ai_images_limit' => 500,
'ai_videos_limit' => 100,
'data_retention_days' => 90,
'sort' => 3,
],
[
'slug' => Slug::Max,
'name' => 'Max',
'stripe_monthly_price_id' => env('STRIPE_MAX_MONTHLY'),
'stripe_yearly_price_id' => env('STRIPE_MAX_YEARLY'),
'monthly_price' => 9900,
'yearly_price' => 99000,
'social_account_limit' => 100,
'member_limit' => 20,
'workspace_limit' => 50,
'ai_images_limit' => 2000,
'ai_videos_limit' => 500,
'data_retention_days' => 730,
'sort' => 4,
],
];
foreach ($plans as $plan) {
Plan::updateOrCreate(
['slug' => $plan['slug']],
$plan,
);
}
}
}