fapost / support
FAPost reusable Eloquent primitives — traits, base model, and model concerns
Requires
- php: ^8.4
- fapost/foundation: *
- illuminate/database: ^11.0 || ^12.0
- illuminate/support: ^11.0 || ^12.0
Requires (Dev)
- phpunit/phpunit: ^11.0
This package is not auto-updated.
Last update: 2026-08-04 02:50:35 UTC
README
fapost/support holds reusable Eloquent primitives — a base model, opt-in model concerns and
the fluent config-schema builder. These are shared building blocks with no Core coupling, usable
by Core and by external Solutions/Plugins alike.
Design rules
- No dependency on Core.
use App\...is forbidden here. Support may depend onfapost/foundationcontracts, but never on concrete Core domain classes. - Primitives, not business logic. A class that carries domain semantics belongs in a Core domain. A contract meant for external Solutions/Plugins belongs in Foundation. What lands here is the pure, reusable middle.
Requirements
- PHP
^8.4 illuminate/database/illuminate/support^11 || ^12fapost/foundation
Namespace
FAPost\Support\ → src/
What's inside
Models\BaseModel
An abstract Eloquent model wiring three opt-in extension points. All are inert unless the model declares the corresponding property:
| Concern | Opt-in property | Effect |
|---|---|---|
HasComputedAttributes |
— (resolver-backed) | Computed/virtual attributes via ModelAttributeResolverInterface, falling back to Eloquent |
InteractWithUtilities |
$utilitiesClass |
Delegates unknown method calls to a ModelUtilityInterface class |
InteractWithBuilder |
$customBuilder |
Swaps in a custom Eloquent query builder |
HasComputedAttributesandInteractWithUtilitiesresolve their collaborators viaapp()— an accepted infrastructure exception, since Eloquent instantiates models directly and bypasses constructor DI.
Concerns\HasUlidPrimaryKey
ULID primary keys stored as PostgreSQL uuid (RFC-4122, lowercased), per the platform ID strategy.
Use it on any tenant-schema model that follows this convention.
final class Contact extends BaseModel { use HasUlidPrimaryKey; }
Builder\Schema
A fluent builder for the array shape returned by NodeHandlerInterface::configSchema(). Schema,
Section and the Fields\* classes produce exactly the wire format the Vue flow builder consumes,
so handlers can mix fluent and raw arrays during migration. Each field's type() maps 1:1 to the
renderer's FIELD_COMPONENTS table.
Available field types: Text, Textarea, Number, Toggle, Select, EnumCards, Array,
Object, ObjectArray, KeyValue, Json, Duration, FlowPicker, StatePicker.
Schema::make() ->section( Section::make('General')->fields( TextField::make('label')->label('Label')->required(), ToggleField::make('enabled')->default(true), ), );
Testing
License
Licensed under the Apache License 2.0.