mpociot/laravel-composite-key
Adds support for composite primary keys in Laravel Eloquent models. This package lets models with multi-column keys work with common Eloquent operations like saving, updating, deleting, and finding records, without hacking around the framework's single-key assumptions.
mpociot/laravel-composite-key adds first-class support for composite primary keys to Laravel's Eloquent ORM. Instead of forcing a single auto-incrementing ID, models can define an array of key columns and let the package handle lookups, persistence, and key generation behind the scenes.
It is designed as a drop-in trait for existing Eloquent models, keeping composite-key logic isolated while preserving normal model behavior.
$primaryKeyHow can I help you explore Laravel packages today?