mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
corregida busqueda de usuarios. también el mail obligatorio y borrar los chat departaments con soft delete
This commit is contained in:
@ -22,6 +22,14 @@ class UserModel extends ShieldUserModel
|
||||
];
|
||||
}
|
||||
|
||||
const SORTABLE = [
|
||||
0 => "t1.id",
|
||||
1 => "t1.first_name",
|
||||
2 => "t1.last_name",
|
||||
3 => "t2.secret",
|
||||
4 => "t1.last_active",
|
||||
];
|
||||
|
||||
protected $returnType = UsersEntity::class;
|
||||
|
||||
protected $useSoftDeletes = true;
|
||||
@ -33,6 +41,7 @@ class UserModel extends ShieldUserModel
|
||||
protected $validationRules = [
|
||||
"first_name" => "required|trim|max_length[150]",
|
||||
"last_name" => "required|trim|max_length[150]",
|
||||
"email" => "required|valid_email|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]"
|
||||
@ -56,9 +65,40 @@ class UserModel extends ShieldUserModel
|
||||
'comments' => [
|
||||
"max_length" => "Users.validation.last_name.max_length",
|
||||
],
|
||||
'email' => [
|
||||
"required" => "Users.validation.email.required",
|
||||
"valid_email" => "Users.validation.email.valid_email",
|
||||
"max_length" => "Users.validation.email.max_length"
|
||||
]
|
||||
|
||||
];
|
||||
|
||||
public function getResource($search = [])
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id as id, t1.first_name AS first_name, t1.last_name AS last_name,
|
||||
t2.secret AS email, t1.last_active AS last_active"
|
||||
);
|
||||
|
||||
$builder->join("auth_identities t2", "t1.id = t2.user_id", "left");
|
||||
$builder->where('t1.deleted_at', null)->groupBy("t1.id");
|
||||
|
||||
|
||||
|
||||
if (empty($search))
|
||||
return $builder;
|
||||
else {
|
||||
$builder->groupStart();
|
||||
foreach ($search as $col_search) {
|
||||
$builder->like(self::SORTABLE[$col_search[0]], $col_search[2]);
|
||||
}
|
||||
$builder->groupEnd();
|
||||
return $builder;
|
||||
}
|
||||
}
|
||||
|
||||
public function getComerciales()
|
||||
{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user