Robstar wrote a reply+100 XP
1d ago
A view composer is also an option - https://laravel.com/docs/13.x/views#view-composers
Robstar wrote a reply+100 XP
1d ago
Have you tried https://github.com/laradock/laradock - that's pretty easy to get up and running.
Robstar liked a comment+100 XP
1mo ago
You can use object destructuring with pinia, you just have to use storeToRefs (https://pinia.vuejs.org/core-concepts/#Destructuring-from-a-Store) for all reactive properties.
const cartStore = useCartStore();
const { cart, subtotal, taxes, total } = storeToRefs(cartStore);
const { incrementProduct } = cartStore;
Robstar liked a comment+100 XP
1mo ago
For working with local storage, I like to use VueUse's useStorage (https://vueuse.org/core/useStorage/), which makes the local storage reactive.
Robstar wrote a comment+100 XP
1mo ago
I'd probably reach for a composable here as it's much clearer as where the data is from. The coupling is very low too as the composable can be used anywhere in the app. For myself, they're the closest thing to Vuex / Pinia, without using Vuex / Pinia (although everytime I've opted out of using Pinia I've always regretted it - you can see how complicated things get wehn you have nested com,ponents, as in this shoipping cart demo).