Recommend this page to a friend! |
Download |
Info | Documentation | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not enough user ratings | Total: 45 | All time: 10,796 This week: 36 |
Version | License | PHP version | Categories | |||
eloquent-composite-k 1.0.0 | MIT/X Consortium ... | 5 | PHP 5, Databases, Libraries, Design P... |
Package to enable composite key support on Eloquent Models.
Install it with composer:
composer require thiagoprz/eloquent-composite-key
Define the primaryKey as an array and use the HasCompositeKey trait on your model.
class User extends Model
{
use HasCompositeKey;
...
protected $primaryKey = ['firstKey', 'secondKey'];
...
}
The idea of this package is to allow eloquent models to use composite keys despite that Eloquent doesn't support it officially (see https://laravel.com/docs/8.x/eloquent#composite-primary-keys).
Files (3) |
File | Role | Description | ||
---|---|---|---|---|
src (1 file) | ||||
composer.json | Data | Auxiliary data | ||
README.md | Doc. | Documentation |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
eloquent-composite-k-2021-03-25.zip 1KB | |
eloquent-composite-k-2021-03-25.tar.gz 1KB | |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.