PHP-035 / Intermediate
Loose validation rules (accepting foreign keys without exists)
Why is this a problem?
Associating category or team IDs owned by another user breaks data integrity and authorization.
How to fix it
php
$request->validate([
'team_id' => ['required', Rule::exists('teams', 'id')->where('owner_id', $request->user()->id)],
]);