Welcome Guest, Not a member yet? Register   Sign In
Custom validation

hi i have a problem to validate is_unique with soft delete , i create a custom rule :
  * Funzione che controlla se è presente la macchina in magazzino
    public function macchina_presente_is_unique(string $str,string $fields, array $data)
        $macchina_model = new MacchinaModel();

        $macchina = $macchina_model->where('seriale',$data['seriale'])->first();

        if ($macchina) {

            return false;

            return true;

There is a way to add a field to ignore id as is_unique {id}

PHP Code:

(This post was last modified: 05-09-2023, 12:04 PM by pippuccio76.)

(05-08-2023, 04:53 PM)Mni.day Wrote:
PHP Code:

No in this way Is the same as is_unique ... 

I want add a value tò control the id , i create another function , i want know of Is It possible do with only one function

Theme © iAndrew 2016 - Forum software by © MyBB