you have to use
function ($value) use ($sort){}
Like mikhailkozlov said you need to write 'use' keyword. PHP closures have their own scope so if you want to use some variables from outside of this closure, you have to pass them to use() keyword. Then you can use them inside.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community