ignoreRecord for TextColumn with different slugs for each domain
Hello! I'm fighting for hours with this and maybe just your experience can help me in minutes.
The situation
Users should be able to create custom links for different domains.
Model 1 = Domain
Model 2 = Link (with column for the 'slug')
Different domains should be able to have same slug:
domain1/slugxyz
domain2/slugxyz
So I created a custom Rule at that input on the Form.
It gets the domain_id from the Select field with the ->live() option.
The goal check if a Link for that Domain with that slug exists. If not, continue. If yes, give error
The problem: when trying to edit a record, it says it already exists
I tried the option ->unique(ignoreRecord: true). But, as i should be able to have same slug for different domains (but just 1 for each domain), i didn't manage to make it work.
Thank you!
0 Replies