class FindCustomer extends Component { public string $codbar = '';
public function find(){
$customers = Customer::with('lightbulbs')->whereHas('lightbulbs', function($q) use ($this->codbar){
});
(...)
What I wannt is to pass a parameter to the whereHas function so I don't have to do:
(...)
$codbar = $this->codbar;
$customers = Customer::with('lightbulbs')->whereHas('lightbulbs', function($q) use ($codbar){
(...)
Any help, please?
Alberto.
I found out that $this->codbar is accesible inside anonymous function. It's no necessary to use 'use'.
Thanks anyway.