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