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 getPerfil() | |
{ | |
return $this->hasOne(Perfil::className(), ['user_id' => '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
public function getUsers() | |
{ | |
return $this->hasMany(User::className(), ['estado_id' => '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
/** | |
* relación get estado | |
* | |
*/ | |
public function getEstado() | |
{ | |
return $this->hasOne(Estado::className(), ['id' => 'estado_id']); | |
} | |
/** | |
* * get estado nombre |
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 getUsers() | |
{ | |
return $this->hasMany(User::className(), ['tipo_usuario_id' => '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
public function getTipoUsuario() | |
{ | |
return $this->hasOne(TipoUsuario::className(), ['id' => 'tipo_usuario_id']); | |
} | |
/** | |
* get tipo usuario nombre | |
* | |
*/ | |
public function getTipoUsuarioNombre() | |
{ |
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
'generoNombre' => Yii::t('app', 'Genero'), | |
'userLink' => Yii::t('app', 'User'), | |
'perfilIdLink' => Yii::t('app', 'Perfil'), |
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
/** | |
* @getPerfilId | |
* | |
*/ | |
public function getPerfilId() | |
{ | |
return $this->perfil ? $this->perfil->id : 'ninguno'; | |
} | |
/** | |
* @getPerfilLink |
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 user id Link | |
* | |
*/ | |
public function getUserIdLink() | |
{ | |
$url = Url::to(['user/update', 'id'=>$this->id]); | |
$opciones = []; | |
return Html::a($this->id, $url, $opciones); | |
} |
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
/* Las etiquetas de los atributos de su modelo */ | |
public function attributeLabels() | |
{ | |
return [ | |
/* Sus otras etiquetas de atributo */ | |
'rolNombre' => Yii::t('app', 'Rol'), | |
'estadoNombre' => Yii::t('app', 'Estado'), | |
'perfilId' => Yii::t('app', 'Perfil'), | |
'perfilLink' => Yii::t('app', 'Perfil'), | |
'userLink' => Yii::t('app', 'User'), |
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; | |
class RegistrosHelpers | |
{ | |
public static function userTiene($modelo_nombre) | |
{ | |
$conexion = \Yii::$app->db; |
OlderNewer