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

hi i have a problem to validate is_unique with soft delete , i create a custom rule :
Code:
    /**
  * 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;
        }else{

            return true;
        }

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


Messages In This Thread
Custom validation - by pippuccio76 - 05-04-2023, 07:51 AM
RE: Custom validation - by Mni.day - 05-08-2023, 04:53 PM
RE: Custom validation - by pippuccio76 - 05-09-2023, 12:00 PM



Theme © iAndrew 2016 - Forum software by © MyBB