alijumaan / laravel-ecommerce

142 stars 71 forks source link

Suggestion within the foreach #33

Open trondhuso opened 1 year ago

trondhuso commented 1 year ago

https://github.com/alijumaan/laravel-ecommerce/blob/27ff3b42935b1564a1cca5d122821c8addcaf7cd/app/Services/OrderService.php#L33

It might be a good idea to create a variable with the content of Cart::content()

Back in my early days with PHP, I learned that doing it the way it is on the current like, PHP would go and look up all the time. By storing the content in a variable you bypass this behaviour - if this is still the case for PHP in 2022.

Just something to consider.

sakibbuddy commented 1 year ago

Please close this issue. @alijumaan