1. Go to this page and download the library: Download alexinator1/yii2-jta 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/ */
alexinator1 / yii2-jta example snippets
class User extends \alexinator1\jta\ActiveRecord
{
....
}
class Group extends \alexinator1\jta\ActiveRecord
{
....
}
class Group extends \alexinator1\jta\ActiveRecord
{
...
public function getUsers()
{
return $this->hasMany(User::className(), ['id' => 'user_id'])
->viaTable('user_group', ['group_id' => 'id'], null, ['role', 'joined_at']);
}
...
}