Контроллер
Код: Выделить всё
public function actionIndex()
{
$par = Participants::find()->andFilterWhere(['man_id' => Yii::$app->user->id])->all();
$participants = $par->deal_id;
$dealList = Deal::find()->andFilterWhere(['author_id' => Yii::$app->user->id])->andFilterWhere(['id' => $par->deal_id])->all();
return $this->render('index', [
'dealList' => $dealList,
]);
}
БД
Модель
Код: Выделить всё
<?php
namespace app\models;
use Yii;
/**
* This is the model class for table "participants".
*
* @property int $man_id
* @property int $deal_id
* @property string $email
*/
class Participants extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'participants';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['email'], 'required'],
[['man_id', 'deal_id'], 'integer'],
[['email'], 'string', 'max' => 40],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'man_id' => 'Man ID',
'deal_id' => 'Deal ID',
'email' => 'Почта пользователя',
];
}
}