sebwas/laravel-eloquent-compound-keys

This package is abandoned and no longer maintained. No replacement package was suggested.

This helps using eloquent when using compound keys in the database

v1.0.4 2016-06-17 15:23 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:56:04 UTC


README

Usage

In your Model that uses the compound keys, simply put use SebWas\Laravel\Eloquent\CompoundKeys;. If another Model is referencing this through a HasManyThrough relationship, use the SebWas\Laravel\Eloquent\CompoundKeysRelationship trait with it.

Limits

There are a few limits to this, that can be solved by overriding the functions and re-implementing them properly.

  • The static destroy can't be called
  • The morphTo relationship won't work
  • HasManyThrough's getHasCompareKey doesn't work
  • Some other functions, especially on relations may be buggy