Laravel catch-all route for Vue Single Page Applications

Introduction

Building a complex VueJS SPA implies a lot more challenges than an ordinary application. At my job we are creating a VueJS powered SAAS platform, which shows us how powerful this library is, but also how easy it is to misunderstand things.

The Problem

This application is built upon a set of APIs provided by Laravel. We also have a few routes with static regular pages. Our RouteServiceProvider.php looks like the following:

<?php

public function map(Router $router)
{ …
Read More
Building a basic reserved area with ProcessWire

Introduction

In this tutorial we will learn how to add a simple reserved area to an existing ProcessWire website, using two handy modules, an external package and a few tricks.

In short we will build a protected page on our site, where users of a specific role can log in using their credentials, see a list of documents that the administrator made available to them, and download each one using a secure link.

Notice: If you don’t where to start with ProcessWire, I suggest you to look …

Read More
Practical use case for React.js High Order components

Introduction

Since the React core team dropped the support for mixins, which were the standard way of sharing code between components, the use of composition over inheritance has become the right way for building user interfaces.

A High Order Component (HOC from now on) is a pattern for reusing component logic that has evolved to maturity. It’s used throughout many famous libraries like Redux or React-Router, and it’s a direct consequence of React’s compositional nature. …

Read More
Split char-separated values in MySQL

Introduction

Recently I needed to extract a list of URLs from a MySQL table. All those URLs were inserted in a single TEXT column, however they were all separated by semicolons. The situation was more or less like the following:

SELECT * FROM links

---------------------------------------------------------------
| id | urls                                                   |
---------------------------------------------------------------
|  1 | http://first.link;http://second.link …
Read More
Feature Flags in ProcessWire

Introduction

While building a website or an application, it’s often useful to control which parts are visibile (and which are not) to the actual users. Maybe you just want to hide a particular functionality on which you are still working, or maybe you just want to reveal things gradually without deploying new code in production. This concept is called Feature flags or Feature toggles.

Feature Flag is a technique to turn some functionality of your application off, via configuration, …

Read More
Using ProcessWire InputFieldDateTime via API

Introduction

Recently I had the need to create a custom form in the backend, using the API and InputField modules that ProcessWire provides. Think InputFields as the basic building blocks to create forms in ProcessWire. They are used all over the administration panel, and provide styling (via jQuery UI), validation ad error rendering (through the FormBuilder) out of the box.

Here is an example of how you can use the API to create a basic form. The code is taken from this PW forum thread …

Read More