Welcome Guest, Not a member yet? Register   Sign In
CI4 Validation is_unique in properties Config/Validation
#6

(This post was last modified: 08-17-2020, 09:03 AM by jreklund.)

Validation Placeholders where a unique feature for Models, but have been ported to Controllers as well. So {id} now works as intended.

Input:
Code:
'perm' => 'trim|required|is_unique[permission.perm,id,$perm_id]'

Output: ' don't evaluate the variables, the output remains the same.
Code:
'perm' => 'trim|required|is_unique[permission.perm,id,$perm_id]'

Input:
Code:
'perm' => 'trim|required|is_unique[permission.perm,id,'.$perm_id.']'

Output: You have opened the string and closed it again, it works.
Code:
'perm' => 'trim|required|is_unique[permission.perm,id,4]'

If you change ' into " it will evaluate the variable.

Input:
Code:
'perm' => "trim|required|is_unique[permission.perm,id,$perm_id]"

Output:
Code:
'perm' => "trim|required|is_unique[permission.perm,id,4]"
Reply


Messages In This Thread
RE: CI4 Validation is_unique in properties Config/Validation - by jreklund - 08-17-2020, 09:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB