Laravel 11 + Livewire 3/Volt + Alpine.js + Tailwind app for household budget planning, transaction tracking, and financial dashboards. - Multi-tenant households with member invites - Plan: monthly/yearly budget per category with overrides - Suivi: transaction log with running balance (desktop + mobile quick-entry) - Dashboard: budget vs tracked breakdown + Chart.js donuts - Flux: Sankey diagram of income allocation - WCAG 2.1 AA color tokens, dark mode, accessible tables/forms - 50 Pest tests Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
40 lines
869 B
PHP
40 lines
869 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Livewire\Household;
|
|
|
|
use App\Models\Household;
|
|
use Livewire\Attributes\Layout;
|
|
use Livewire\Component;
|
|
|
|
#[Layout('layouts.guest')]
|
|
class Create extends Component
|
|
{
|
|
public string $name = '';
|
|
|
|
public function create(): void
|
|
{
|
|
$this->validate([
|
|
'name' => ['required', 'string', 'max:255'],
|
|
]);
|
|
|
|
$user = auth()->user();
|
|
|
|
$household = Household::create([
|
|
'name' => $this->name,
|
|
'owner_id' => $user->id,
|
|
]);
|
|
|
|
$user->households()->attach($household->id, ['role' => 'owner']);
|
|
$user->forceFill(['current_household_id' => $household->id])->save();
|
|
|
|
$this->redirect(route('dashboard', absolute: false), navigate: true);
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
return view('livewire.household.create');
|
|
}
|
|
}
|