RomanAntDev
$consultants = User::whereRole('consultant');
if ($request->has('exp_from')) {
$consultants->has('experiences')->withSum('experiences', 'exp_month');
$sumExp = $consultants->get('experiences_sum_exp_month');
$sumExp->each(function ($exp) use ($request) {
if ($exp->experiences_sum_exp_month >= $request['exp_from']) {
$res[] = $exp;
}
});
}
$consultants->paginate();
[!] Aliasing 'User' to 'App\Models\User' for this Tinker session.
[43mPHP Notice: Undefined variable: request in phar:///tmp/.mount_TinkerdA0qkS/resources/tinkerwell/tinker.phar/index.php(206) : eval()'d code on line 2[49m
[41mCustomErrorException with message 'PHP Error: Call to a member function has() on null in phar:///tmp/.mount_TinkerdA0qkS/resources/tinkerwell/tinker.phar/index.php(206) : eval()'d code on line 2'[49m