39 lines
648 B
PHP
39 lines
648 B
PHP
<?php
|
|
|
|
namespace app\models;
|
|
|
|
class Subscription extends \yii\db\ActiveRecord
|
|
{
|
|
public $user_id;
|
|
public $blog_id;
|
|
|
|
/**
|
|
* {@inheritDoc}
|
|
*/
|
|
public function rules()
|
|
{
|
|
return [
|
|
[['user_id', 'blog_id'], 'required'],
|
|
[['id'], 'integer'],
|
|
];
|
|
}
|
|
|
|
public function getUser()
|
|
{
|
|
return $this->hasOne(User::class, [ 'id' => 'user_id' ]);
|
|
}
|
|
|
|
public function getBlog()
|
|
{
|
|
return $this->hasOne(Company::class, [ 'id' => 'blog_id' ]);
|
|
}
|
|
|
|
/**
|
|
* {@inheritDoc}
|
|
*/
|
|
public function tableName()
|
|
{
|
|
return "subscriptions";
|
|
}
|
|
}
|