Вход на сайт

Просмотр новости

Найдите то, что Вас интересует

fapost/support

Дата публикации: 03-08-2026 17:16:49

FAPost reusable Eloquent primitives — traits, base model, and model concerns

Основное содержимое страницы с новостью.

FAPost reusable Eloquent primitives — traits, base model, and model concerns

Maintainers

41556cf93fd356db054066226b59fd32e9c20686db7de5cdc689dc204e5d7208?s=48&d=identicon

v0.1.0 2026-08-03 16:53 UTC

This package is not auto-updated.

Last update: 2026-08-03 17:22:14 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 on fapost/foundation contracts, 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 || ^12
  • fapost/foundation
Namespace
FAPost\Support\   →  src/
What's insideModels\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

HasComputedAttributes and InteractWithUtilities resolve their collaborators via app() — 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),
        ),
    );
TestingLicense

Licensed under the Apache License 2.0.

Схожие новости

#Наименование новостиТональностьИнформативностьДата публикации
1fapost/foundation01003-08-2026
2ratts/rih01003-08-2026
3apavliukov/laravel-devtools023.9303-08-2026
4A practical guide to React error monitoring07.0629-07-2026
5karelwintersky/arris.config01003-08-2026
60525-05-2026
70005-05-2026
80029-04-2026
9loioes — 0008-07-2026
10Rebuilding the CircleCI CLI from scratch0507-07-2026

Классификация: . Схожих патентов: 0. Схожих новостей: 10. Тональность: 0. Информативность: 8.26. Источник: packagist.org.