PHP code example of diepxuan / eloquent-composite
1. Go to this page and download the library: Download diepxuan/eloquent-composite library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
diepxuan / eloquent-composite example snippets
use Diepxuan\Database\Eloquent\CompositeModel;
class YourModel extends CompositeModel
{
protected $primaryKey = ['column1', 'column2'];
public $incrementing = false;
}
use Illuminate\Database\Eloquent\Model;
use Diepxuan\Database\Eloquent\Traits\HasCompositePrimaryKey;
class YourModel extends Model
{
use HasCompositePrimaryKey;
protected $primaryKey = ['column1', 'column2'];
public $incrementing = false;
}
laravel-eloquent-composite/
├── src/
│ ├── CompositeModel.php
│ └── Traits/
│ └── HasCompositePrimaryKey.php
└── composer.json