Initial commit: SuiviCPT personal finance tracker

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>
This commit is contained in:
jeremy bayse
2026-07-25 22:39:42 +02:00
co-authored by Claude Sonnet 5
commit d8dc57a5df
164 changed files with 19880 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
<?php
declare(strict_types=1);
namespace App\Models;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class BudgetLine extends Model
{
protected $fillable = ['household_id', 'category_id', 'year', 'month', 'amount'];
protected function casts(): array
{
return [
'amount' => 'decimal:2',
];
}
public function household(): BelongsTo
{
return $this->belongsTo(Household::class);
}
public function category(): BelongsTo
{
return $this->belongsTo(Category::class);
}
public function scopeForYear(Builder $query, int $year): Builder
{
return $query->where('year', $year);
}
public function scopeDefaultLine(Builder $query): Builder
{
return $query->whereNull('month');
}
public function scopeForMonth(Builder $query, int $month): Builder
{
return $query->where('month', $month);
}
}
+43
View File
@@ -0,0 +1,43 @@
<?php
declare(strict_types=1);
namespace App\Models;
use App\Enums\CategoryType;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Category extends Model
{
protected $fillable = ['household_id', 'name', 'type', 'position'];
protected function casts(): array
{
return [
'type' => CategoryType::class,
];
}
public function household(): BelongsTo
{
return $this->belongsTo(Household::class);
}
public function budgetLines(): HasMany
{
return $this->hasMany(BudgetLine::class);
}
public function transactions(): HasMany
{
return $this->hasMany(Transaction::class);
}
public function scopeOfType(Builder $query, CategoryType $type): Builder
{
return $query->where('type', $type);
}
}
+47
View File
@@ -0,0 +1,47 @@
<?php
declare(strict_types=1);
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Household extends Model
{
protected $fillable = ['name', 'owner_id'];
public function owner(): BelongsTo
{
return $this->belongsTo(User::class, 'owner_id');
}
public function members(): BelongsToMany
{
return $this->belongsToMany(User::class, 'household_user')
->withPivot('role')
->withTimestamps();
}
public function categories(): HasMany
{
return $this->hasMany(Category::class);
}
public function budgetLines(): HasMany
{
return $this->hasMany(BudgetLine::class);
}
public function transactions(): HasMany
{
return $this->hasMany(Transaction::class);
}
public function invites(): HasMany
{
return $this->hasMany(HouseholdInvite::class);
}
}
+41
View File
@@ -0,0 +1,41 @@
<?php
declare(strict_types=1);
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class HouseholdInvite extends Model
{
protected $fillable = ['household_id', 'invited_by', 'email', 'token', 'role', 'accepted_at', 'expires_at'];
protected function casts(): array
{
return [
'accepted_at' => 'datetime',
'expires_at' => 'datetime',
];
}
public function household(): BelongsTo
{
return $this->belongsTo(Household::class);
}
public function inviter(): BelongsTo
{
return $this->belongsTo(User::class, 'invited_by');
}
public function isExpired(): bool
{
return $this->expires_at->isPast();
}
public function isAccepted(): bool
{
return $this->accepted_at !== null;
}
}
+37
View File
@@ -0,0 +1,37 @@
<?php
declare(strict_types=1);
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Transaction extends Model
{
protected $fillable = ['household_id', 'category_id', 'user_id', 'date', 'date_effective', 'amount', 'details'];
protected function casts(): array
{
return [
'date' => 'date',
'date_effective' => 'date',
'amount' => 'decimal:2',
];
}
public function household(): BelongsTo
{
return $this->belongsTo(Household::class);
}
public function category(): BelongsTo
{
return $this->belongsTo(Category::class);
}
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
}
+64
View File
@@ -0,0 +1,64 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Database\Factories\UserFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
/** @use HasFactory<UserFactory> */
use HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $fillable = [
'name',
'email',
'password',
'current_household_id',
];
/**
* The attributes that should be hidden for serialization.
*
* @var list<string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}
public function households(): BelongsToMany
{
return $this->belongsToMany(Household::class, 'household_user')
->withPivot('role')
->withTimestamps();
}
public function currentHousehold(): BelongsTo
{
return $this->belongsTo(Household::class, 'current_household_id');
}
}