Is there a way to do $var = 7 in filtering a collection as follows?
$var = 1; $collection->filter(function( $q ) use ($var){ if( true ){ $var = 7; return true; } }); dd( $var );
This is currently not working and I am still getting 1
I also tried using global , but still I get 1
source share