Level 80
@Coffeework The Laravel validation documentation for the unique rule has a section on adding where clauses to your validation rules:
'name' => Rule::unique('items')->where('team_id', $this->route('team_id')),
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I want to make a validation that makes something unique only for a team, for example: Iteam_name: fish, tomato, coca cola(but you cannot add in this team an item twice)
@Coffeework The Laravel validation documentation for the unique rule has a section on adding where clauses to your validation rules:
'name' => Rule::unique('items')->where('team_id', $this->route('team_id')),
Please or to participate in this conversation.