Welcome Guest, Not a member yet? Register   Sign In
How to use is_unique?
#1

(This post was last modified: 04-18-2020, 09:14 AM by 5flex.)

I have a controller with code:
PHP Code:
...... other code .....
$props['login'] = 'test';
$props['mail'] = '[email protected]';

$this->validation->run($props'myrules');
...... 
other code ...... 

And now....In my app/Config/Validation.php I write next property:

PHP Code:
public $myrules = [
        
'login' => "is_unique[admins.login,id,{id}]",
        
'mail'  => 'is_unique[admins.mail,id,{id}]',
          



How I can transfer in THIS rule my VARIABLE WITH user ID??!!!

I want to GET the next code (as example):
PHP Code:
public $myrules = [
        
'login' => "is_unique[admins.login,id,314]",
                'mail'  => 'is_unique[admins.mail,id,314]',

    ];

// and next will GET query
// SELECT 1 FROM admins WHERE login = 'test' AND id != 314 


My QUESTION: "HOW TO SEND VARIABLE VALUE IN THE LAST ARGUMENT FROM MY CONTROLLER DINAMICALLY?"
Reply


Messages In This Thread
How to use is_unique? - by 5flex - 04-18-2020, 09:04 AM
RE: How to use is_unique? - by includebeer - 04-18-2020, 03:40 PM
RE: How to use is_unique? - by 5flex - 04-18-2020, 09:30 PM
RE: How to use is_unique? - by includebeer - 04-19-2020, 04:47 AM
RE: How to use is_unique? - by 5flex - 04-19-2020, 05:33 AM
RE: How to use is_unique? - by jreklund - 04-19-2020, 06:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB