Yes, you are using your arguments incorrectly. :)
It should be like this:
$processos_cli = Processo::with(['cliente' => function ($query) use ($search) {
$query->where('nomefantasia', 'like', "%$search%");
}])
->get();
Closures may also inherit variables from the parent scope. Any such variables must be passed to the use language construct.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community