diff --git a/src/app/Http/Controllers/API/SignupController.php b/src/app/Http/Controllers/API/SignupController.php --- a/src/app/Http/Controllers/API/SignupController.php +++ b/src/app/Http/Controllers/API/SignupController.php @@ -39,7 +39,9 @@ { // Use reverse order just to have individual on left, group on right ;) // But prefer monthly on left, yearly on right - $plans = Plan::withEnvTenantContext()->orderBy('months')->orderByDesc('title')->get() + $plans = Plan::withEnvTenantContext()->where('hidden', false) + ->orderBy('months')->orderByDesc('title') + ->get() ->map(function ($plan) { $button = self::trans("app.planbutton-{$plan->title}"); if (strpos($button, 'app.planbutton') !== false) { diff --git a/src/app/Plan.php b/src/app/Plan.php --- a/src/app/Plan.php +++ b/src/app/Plan.php @@ -19,6 +19,7 @@ * @property int $discount_qty * @property int $discount_rate * @property int $free_months + * @property bool $hidden * @property string $id * @property string $mode Plan signup mode (Plan::MODE_*) * @property string $name @@ -44,6 +45,7 @@ /** @var array The attributes that are mass assignable */ protected $fillable = [ 'title', + 'hidden', 'mode', 'name', 'description', @@ -66,6 +68,7 @@ 'promo_to' => 'datetime:Y-m-d H:i:s', 'discount_qty' => 'integer', 'discount_rate' => 'integer', + 'hidden' => 'boolean', 'months' => 'integer', 'free_months' => 'integer' ]; diff --git a/src/database/migrations/2023_10_18_100000_plans_hidden.php b/src/database/migrations/2023_10_18_100000_plans_hidden.php new file mode 100644 --- /dev/null +++ b/src/database/migrations/2023_10_18_100000_plans_hidden.php @@ -0,0 +1,38 @@ +boolean('hidden')->default(false); + } + ); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table( + 'plans', + function (Blueprint $table) { + $table->dropColumn('hidden'); + } + ); + } +}; diff --git a/src/tests/Feature/Controller/SignupTest.php b/src/tests/Feature/Controller/SignupTest.php --- a/src/tests/Feature/Controller/SignupTest.php +++ b/src/tests/Feature/Controller/SignupTest.php @@ -114,6 +114,13 @@ { $individual = Plan::withEnvTenantContext()->where('title', 'individual')->first(); $group = Plan::withEnvTenantContext()->where('title', 'group')->first(); + $hidden = Plan::create([ + 'title' => 'test', + 'name' => 'Test Account', + 'description' => 'Test', + 'hidden' => true, + 'mode' => Plan::MODE_MANDATE, + ]); $response = $this->get('/api/auth/signup/plans'); $json = $response->json();