How to include a variable in the hard storage of a Laravel controller?

I upload an image to the server via a controller. In the controller, the path is created and then saved to the database … It works well, but I have to add a directory name dynamically to the route to differentiate it from the others, and I try with a variable, but I do not take the road.

So it works perfectly:

$ path = Storage :: disk ("public") -> put ("images / events /", $ request-> file ("cover"));

I have the following:

$ path = Storage :: disk ("public") -> put (images / events / $ code, $ request-> file (& # 39; cover & # 39; ;));

I want the following results if my $ code variable contains 0504

$ path = Storage :: disk ("public") -> put ("images / events / 0504", $ request-> file (& # 39; cover & # 39;)) ;

I have tried in many ways but I can not do it …

$ path = Storage :: disk ("public") -> put ("images / events /". $ code. "#, $ request-> file ( & # 39; cover & # 39;));

$ path = Storage :: disk ("public") -> put ("images / events / $ code.", $ request-> file (& # 39; cover & # 39;));

$ path = Storage :: disk ("public") -> put ("images / events /" $ code. ", $ request-> file (& # 39; cover & # 39;));

$ path = Storage :: disk (& # 39;) -> put (images / events /. $ code., $ request-> file (& # 39; cover & # 39;));