PHP-089 / Intermediate
N+1 or DoS through nested Eloquent relationship loading
Why is this a problem?
Allowing request parameters to determine loading depth can generate numerous queries.
How to fix it
php
$allowed = ['posts', 'profile'];
User::with(array_intersect((array) $request->input('relations'), $allowed))->get();