Its because of how anonymous functions work. You have to explicitly tell them what variables you want to use inside their scope.
PHP.net Anonymous functions Example #3.
Its not Laravel related but PHP related. You already have a use
statement for that closure, so add your additional vars needed to it.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community