Looking to hire Laravel developers? Try LaraJobs

laravel-eloquent-compound-keys maintained by sebwas

Description
This helps using eloquent when using compound keys in the database
Last update
2016/06/17 17:23 (dev-master)
License
Links
Downloads
70

Comments
comments powered by Disqus

Laravel Eloquent compound keys support

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