Añadido campo de verficacion de contraseña y campo de notas

This commit is contained in:
imnavajas
2024-07-16 22:52:05 +02:00
parent 57688a5310
commit 0b6ce06c96
5 changed files with 150 additions and 108 deletions

View File

@ -18,6 +18,7 @@ class UserModel extends ShieldUserModel
'first_name', // Añadido
'last_name', // Añadido
'cliente_id', // Añadido
'comments', // Añadido
];
}
@ -27,19 +28,41 @@ class UserModel extends ShieldUserModel
protected $useTimestamps = true;
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
protected $deletedField = 'deleted_at';
protected $deletedField = 'deleted_at';
protected $validationRules = [
"username" => [
"label" => "correo duplicado",
"rules" => "is_unique[users.username]",
]
"first_name" => "required|trim|max_length[150]",
"last_name" => "required|trim|max_length[150]",
'new_pwd' => 'permit_empty|min_length[8]',
'new_pwd_confirm' => 'permit_empty|required_with[new_pwd]|matches[new_pwd]',
"comments" => "permit_empty|trim|max_length[512]"
];
protected $validationMessages = [
'first_name' => [
"max_length" => "Users.validation.first_name.max_length",
"required" => "Users.validation.first_name.required"
],
'last_name' => [
"max_length" => "Users.validation.last_name.max_length",
"required" => "Users.validation.last_name.required"
],
'new_pwd' => [
'min_length' => "App.profile_rules_password_m"
],
'new_pwd_confirm' => [
'matches' => "App.profile_rules_password_confirm_m"
],
'comments' => [
"max_length" => "Users.validation.last_name.max_length",
],
];
public function getComerciales(){
public function getComerciales()
{
$builder = $this->db
->table("users" . " t1")
->select(
@ -54,23 +77,5 @@ class UserModel extends ShieldUserModel
}
public function getUsersList()
{
$builder = $this->db
->table('users t1')
->select('
t1.id AS id,
t1.first_name AS first_name,
t1.last_name AS last_name,
t1.email AS email,
t1.last_active AS last_active,
GROUP_CONCAT(DISTINCT t2.`group` SEPARATOR ", ") AS `group`
')
->join('auth_groups_users t2', 't1.id = t2.user_id', 'left')
->where('t1.deleted_at', null)
->groupBy('t1.id, t1.first_name, t1.last_name, t1.email, t1.last_active');
return $builder->get()->getResult();
}
}