# Filament v4 + Binary UUID v7 - Edit Route Issue## Context

I'm working with Laravel 12 and Filament 4.x, using binary UUID v7 (16 bytes) as primary keys in users and invoices tables. The goal is to store UUIDs in binary format in the database for better performance, but expose them as UUID v7 strings (36 characters) in routes and Filament's interface.

Main Problem

Filament edit routes are generating URLs with malformed UUIDs and returning 404. For example:
  • Generated URL: https://binaryuuid.test/admin/invoices/30313961-6637-6534-2d63-3933652d3733/edit
  • Error: 404 Not Found
  • Expected UUID: 019af7e4-c93e-73f9-a5ab-bc6e56c25535
The UUID in the URL appears to be an incorrect hexadecimal encoding of the UUID string.

Current Architecture


Database

  • id
    columns are binary(16) to store UUIDs in binary format
  • Affected tables: users, invoices, customer_identities, invoice_items
### Models
  • HasBinaryUuid trait that handles conversion between binary and UUID string
  • Custom BinaryUuid cast implementing CastsAttributes
  • Overridden methods:
    • getKey()
      • returns UUID string
    • getRouteKey()
      • returns UUID string for routes
    • getAuthIdentifier()
      • returns binary (16 bytes) for sessions
    • resolveRouteBinding()
      • converts UUID string to binary for lookups
    • getAttributes()
      • converts binaries to UUID strings for Livewire
### Filament Resources
  • EditInvoice page with overridden mount() to manually resolve the record
  • mutateFormDataBeforeFill() method to convert binaries to UUID strings before serialization
Was this page helpful?