Mirrors the frontend catch-up in 570f17e: a substantial amount of
finished-but-never-committed backend work had accumulated locally.
- New CustomField module: admin-managed field definitions per client,
reorderable, typed values stored per client (backing the frontend's
ClientCustomFieldCard + settings/fields page)
- History entries switch from a hardcoded type enum to a dynamic,
admin-managed HistoryType module (reorderable, backing
settings/history-types)
- New Import module: CSV client import (backing settings/import)
- Clients table gains soft deletes (deleted_at)
- Supporting factories, seeders, policies, and feature tests for all
of the above
All 63 backend tests pass locally before this commit.
35 lines
885 B
PHP
35 lines
885 B
PHP
<?php
|
|
|
|
namespace App\Modules\Client\Models;
|
|
|
|
use App\Modules\CustomField\Models\CustomFieldValue;
|
|
use App\Modules\History\Models\HistoryEntry;
|
|
use Database\Factories\ClientFactory;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class Client extends Model
|
|
{
|
|
use HasFactory, SoftDeletes;
|
|
|
|
protected $fillable = ['client_number', 'name', 'notes'];
|
|
|
|
protected $casts = ['notes' => 'array'];
|
|
|
|
protected static function newFactory(): ClientFactory
|
|
{
|
|
return ClientFactory::new();
|
|
}
|
|
|
|
public function historyEntries(): HasMany
|
|
{
|
|
return $this->hasMany(HistoryEntry::class);
|
|
}
|
|
|
|
public function customFieldValues(): HasMany
|
|
{
|
|
return $this->hasMany(CustomFieldValue::class);
|
|
}
|
|
}
|