<?php

namespace App\Livewire\Homepage;

use App\Models\Plan;
use Livewire\Component;

class Preise extends Component
{
    public $plans;
    public string $billing = 'monthly';

    public function mount()
    {
        if (auth()->check()) {
            return redirect()->route('plans.index');
        }

        $this->plans = Plan::public()->where('active', true)
            ->with(['features', 'features.group'])
            ->orderBy('sort')
            ->get();
    }

    public function render()
    {
        return view('livewire.homepage.preise')
            ->layout('layouts.blank');
    }
}
