Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Ranx99's avatar

Validate Array Values !?

I want to check some values inside an array if they are unique in some database tables column:

selectedCruds fields request:

array:4 [▼
  0 => "create-course"
  1 => "edit-course"
  2 => "update-course"
  3 => "delete-course"
]

Now I want to check if the values are unique inside permissions table,name..

I tried this but its not working :

$this->validate(
            $request,
            [
            'selectedCruds.*'=>'unique:permissions,name',
            ]
        );

am I using (.*) right !?

0 likes
1 reply
Ranx99's avatar

should I be use Validator::make to make it work !?

Please or to participate in this conversation.