awkwardideas / eloquentcomposite
Composite Key capabilities for Eloquent
Installs: 422
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 0
pkg:composer/awkwardideas/eloquentcomposite
Requires
- php: >=7.0
- illuminate/database: >=5.6 <10.0
Requires (Dev)
- ext-sqlite3: *
README
Install Via Composer
composer require awkwardideas/eloquentcomposite
Add to config/app.php
Under Package Service Providers Add
AwkwardIdeas\EloquentComposite\EloquentCompositeServiceProvider::class,
Use statement on Model
In your model, replace this line:
use Illuminate\Database\Eloquent\Model
With this:
use AwkwardIdeas\EloquentComposite\Model;
Code use
In your model set the following:
protected $connection = '[your_connection_name_here]'; protected $table = '[your_table_name_here]'; protected $compositeKey = ['your', 'composite', 'key', 'columns'];
Then to update a specific column, use:
$this->UpdateWithComposite('column_name');