Laravel – re-assign relationships in updates

Alternate title: Stop stuffing around with entity_id. Working on a project with a representative – a user who looks after the company. When changing the representative, I want to supply the whole representative to the update method – e.g. $customer->representative is an object with an id, name, etc. It’s just a pointer, but it means […]

Vue.js – mapGetters with Params

Using mapGetters with parameters isn’t well defined in the docs, and is a pattern I go to use pretty regularly. I never find a good search result, so here goes: 1.Define the getter in the store. Take note that the naming convention will be [store namespace]/[getter name] later. Since this is in my users store, […]

VueX Patterns: Updating in Array

When working on a type of entity, it’s common to post the new or updated entity to the server and then need to update it in the local vuex data store. This is a simple pattern that propagates the changes to the UI displaying the list of entities. 1. Save the entity, from the UI. […]

Solar in Bargo – numbers

We installed solar at our house in Bargo 2574 (a town in Wollondilly, NSW) in March 2020. It cost approximately $5k for a 6.5kW system (feeding into a 5kW inverter). Half the panels face west, and half face north. I’ve always been concerned that people who install solar need to convince the world that it […]

Vue.js fragments

All manner of googling didn’t turn up a good result for this problem. Sometimes, you need a wrapper component with logic attached that does not render to the UI. For example, child components with a percentage of the parent can’t just have a div wrapped around them for conditional logic. Another example (which I found […]

Dumping redux state on log out

When a user signs out of my mobile app and signs in as a different user, we need to make sure no application state can be carried over. Adding a simple ‘LOGGED_OUT’ action that drops the application state is a straight forward solution. I’m keeping a few properties. Here’s the normal reducers object that is […]

Handling payments securely in React Native

I’m rebuilding an e-commerce mobile app side project (WooToApp) that requires payment for orders created. The initial gateway is Paypal, but it’s an important part of the mobile app that there could be many more gateways, so the architecture needs to be re-usable and secure. Basic architecture Assumptions We need to assume that the mobile […]