mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'main' into 'feat/edit_factura'
Main See merge request jjimenez/safekat!292
This commit is contained in:
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Entities\Usuarios\UsersEntity;
|
||||
use CodeIgniter\Shield\Models\UserModel as ShieldUserModel;
|
||||
|
||||
class UserModel extends ShieldUserModel
|
||||
@ -17,26 +18,51 @@ class UserModel extends ShieldUserModel
|
||||
'first_name', // Añadido
|
||||
'last_name', // Añadido
|
||||
'cliente_id', // Añadido
|
||||
'comments', // Añadido
|
||||
];
|
||||
}
|
||||
|
||||
protected $returnType = UsersEntity::class;
|
||||
|
||||
protected $useSoftDeletes = true;
|
||||
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(
|
||||
@ -51,17 +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.last_active AS last_active, t2.group AS group"
|
||||
);
|
||||
|
||||
$builder->where('t1.deleted_at', null);
|
||||
$builder->join("auth_groups_users t2", "t1.id = t2.user_id", "left");
|
||||
|
||||
return $builder->get()->getResult();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user