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.
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.