laravel-nestedset icon indicating copy to clipboard operation
laravel-nestedset copied to clipboard

unique on parent_id

Open laerciocrestani opened this issue 4 years ago • 0 comments

Hello everybody.

Today in my validate I have the following:

$ request-> validate ([ 'name' => "required | unique: docscategories, name, NULL, id, deleted_at, NULL, parent_id, NULL | max: 255", 'observation' => 'max: 255', ]);

In the figure below, I would like you to ignore it when the user enters an identical name, but for a parent_id who is a member.

  • Cat A (Allow)

    • SubCat A (Allow)
  • Cat B (Allow)

    • SubCat B (Allow)
  • Cat C (Allow)

    • Sub Cat B (Allow)
    • Sub Cat B (Do not allow)
  • Sub Cat B (Allow)

My actual database. Screen Shot 2021-03-12 at 11 28 48

I have all deleted, but when there is a deleted it lets insert. This rule is already created in the validation!

laerciocrestani avatar Mar 12 '21 14:03 laerciocrestani