PHP code example of maksimru / composite-primary-keys
1. Go to this page and download the library: Download maksimru/composite-primary-keys 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/ */
maksimru / composite-primary-keys example snippets
class BinaryKeyUser extends Model
{
use \MaksimM\CompositePrimaryKeys\Http\Traits\HasCompositePrimaryKey;
protected $binaryColumns = [
'user_id'
];
protected $primaryKey = 'user_id';
}
class BinaryKeyUser extends Model
{
use \MaksimM\CompositePrimaryKeys\Http\Traits\HasCompositePrimaryKey;
protected $binaryColumns = [
'user_id'
];
protected $primaryKey = 'user_id';
protected $hexBinaryColumns = true;
}
class TestJob implements ShouldQueue
{
use Queueable, SerializesModels;
private $model;
/**
* Create a new job instance.
*/
public function __construct(TestUser $testUser)
{
$this->model = $testUser;
}
/**
* Execute the job.
*/
public function handle()
{
$this->model->update(['counter' => 3333]);
}
}