This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function behaviors() | |
{ | |
return [ | |
'timestamp' => [ | |
'class' => 'yii\behaviors\TimestampBehavior', | |
'attributes' => [ | |
ActiveRecord::EVENT_BEFORE_INSERT => ['created_at', 'updated_at'], | |
ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at'], | |
], | |
'value' => new Expression('NOW()'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function behaviors() | |
{ | |
return [ | |
'access' => [ | |
'class' => \yii\filters\AccessControl::className(), | |
'only' => ['index', 'view','create', 'update', 'delete'], | |
'rules' => [ | |
[ | |
'actions' => ['index', 'view','create', 'update', 'delete'], | |
'allow' => true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace common\models; | |
use Yii; | |
use yii\base\NotSupportedException; | |
use yii\behaviors\TimestampBehavior; | |
use yii\db\ActiveRecord; | |
use yii\db\Expression; | |
use yii\web\IdentityInterface; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "yiisoft/yii2-app-advanced", | |
"description": "Yii 2 Advanced Application Template", | |
"keywords": ["yii2", "framework", "advanced", "application template"], | |
"homepage": "http://www.yiiframework.com/", | |
"type": "project", | |
"license": "BSD-3-Clause", | |
"support": { | |
"issues": "https://github.com/yiisoft/yii2/issues?state=open", | |
"forum": "http://www.yiiframework.com/forum/", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace common\models; | |
use Yii; | |
use yii\base\NotSupportedException; | |
use yii\behaviors\TimestampBehavior; | |
use yii\db\ActiveRecord; | |
use yii\db\Expression; | |
use yii\web\IdentityInterface; | |
use yii\helpers\Security; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "yiisoft/yii2-app-advanced", | |
"description": "Yii 2 Advanced Application Template", | |
"keywords": ["yii2", "framework", "advanced", "application template"], | |
"homepage": "http://www.yiiframework.com/", | |
"type": "project", | |
"license": "BSD-3-Clause", | |
"support": { | |
"issues": "https://github.com/yiisoft/yii2/issues?state=open", | |
"forum": "http://www.yiiframework.com/forum/", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* get role relationship | |
* | |
*/ | |
public function getRole() | |
{ | |
return $this->hasOne(Role::className(), ['role_value' => 'role_id']); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* get status relation | |
* | |
*/ | |
public function getStatus() | |
{ | |
return $this->hasOne(Status::className(), ['status_value' => 'status_id']); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
*getUserType | |
*line break to avoid word wrap in PDF | |
* code as single line in your IDE | |
*/ | |
public function getUserType() | |
{ | |
return $this->hasOne(UserType::className(), ['user_type_value' => 'user_type_id']); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @return \yii\db\ActiveQuery | |
*/ | |
public function getGenderName() | |
{ | |
return $this->gender->gender_name; | |
} | |
/** |
OlderNewer