You could create a getPriceAttribute() and setPriceAttribute() on the Product model so you don't have to worry about dividing or multiplying by 100. That would be delegated to those methods automatically.
Hello there. I was following these steps and I got this after every second item added to the cart before the page refresh: Livewire \ Exceptions \ CorruptComponentPayloadException: Livewire encountered corrupt data when trying to hydrate the [products-table] component. Ensure that the [name, id, data] of the Livewire component wasn't tampered with between requests.
one problem with these cart packages is that when you associate the cart to a model and if the model is using something like spatie media-library relation, so when displaying the cart content as loop if you do $item->model->thumbnail->url (you will get n+1 queries)
was there a reason why you didn't use the Session facade that comes with laravel? Seems like that would have been easier than having to install a shopping cart package.
Hi. Congratulations for your channel ! I recently subscribed and I love it ! What extension do you have installed in vscode to show the types of parameters in your functions? Thank you
I like your content but the thumbnail quite mislead, you still using JavaScript under the hood yet it the thumbnail say no JavaScript which not hold true
Make a video about refactoring and organizing controller method that contains advanced creating and calculations, for example: When checkout/save a cart I have a store method contains * create parent (sale) * check if parent created, then foreach items, check each item quantity for availability * then create child (sale_items) for each item in a loop * after creating each item, in a IF condition, update Item table to subtract the quantity of the item * wrap them in a transaction in case of failure in any of the items * write a success message
@@LaravelDaily Thank you, I watched this video before (It's been two years!!OMG) and I am watching it again it's so helpful and refreshing for me. A question: findOrFail() is questionable for me when working with API it does show 404 error but (No query results for model [App\\Models\\Purchase] 3), How do I change this error generally in the app? in order to be changed for every findOrFail() wherever to be used.
Hello , Can you make laravel livewire and Custom Cart system tutorial , actualy i learn from custom cart without cart package . please make a video laravel livewire with custom cart
We were thinking about it, but then it would mean to explain somewhere in the documentation how those operations are performed to convert to/from, and there's a big risk that developers wouldn't read that. So we went for less risky option for especially junior Laravel developers, which actually is a big part of our clients.
@@LaravelDaily If you do an additional field, lets say 'Money integer', it would be appreciated. I wouldn't change the old 'money' field, because it may cause many problems to your customers. But making another one instead would do the trick
bro my php version 8.1 but this package is not installing it takes composer require bumbumen99/shoppingcart:* to work but i has Money package which is not working in latest php version pls check
Hey I got a problem, different scenario but similar code I tried to implement from this video, its about a form that works just fine when I insert a new record, but what im trying to do is to get a sibbling component which is the table for all records to display that new one inmediately. So, I have a parent component and two sibblings components, one is the new record form, and the other one the table that should display all records and any new one as soon as it has been inserted into the DB. So after I create that new record, it emits the event from then form-component, and into the list-component the listener is already set up (quite similar to the event that updates the cart quantity after the 'add to cart' process finish the *Cart::add*). I can even see the event triggering, but it just doesnt update the list/table-component, so I have to reload the page to see this new record. Can someone help?
@Laravel Daily I think I found half the problem, when the update comes up, and it triggers the event, wich points to the render method, for some reason, it goes into a where in query (noticed that using the laravel-debugbar) but it shouldnt. When you load the page normally or pressing f5 it will do a Order::orderBy(); wich translates into ''select * from 'orders' order by 'id' desc'', but when its reloaded by the event, it will do that random where in query that only includes the ids of the records already on the table, excluding the fresh new just inserted one. So, it wont never display that new records if it is not inside the wherein condition, but i dont have any idea why this is triggering that Pls help 😕