How can I correctly write my own validation method in my model class?
Namely I need a method that would check if the record with the name submitted from the form already exists in my database. If it exists then submitted data must be considered invalid.
I can’t use ‘unique’. In my database table I have two fields: ‘oblid’ and ‘misto’. I have to validate ‘misto’. In my database there should be no two same mistos with the same ‘oblid’, but there can be many the same mistos with different oblids.