Tailwindcss is a utility-first CSS framework that can be composed to build any design, directly in your markup.
This is a quick tutorial to show how tailwind can be configured in a fresh React application using create react app.
Create a new react application:
npx create-react-app tailwind-demo
cd tailwind-demo
When I run yarn start
and visit the default url localhost:3000
I can see the familiar React page:
How pet microchipping works
At MyPet, we believe that getting your pet microchipped is the best way of making sure you’re reunited if they get lost or stolen. All pets should be microchipped — a collar or tag can fall off or be removed, but a microchip is a more permanent way to identify your pet and keep them safe.
I have an application which has a table of users and a new requirement that these users have an incrementing identifier applied both for new users and existing users. I want to show how to achieve the database migration that needs to be written to retrospectively apply this identifier to existing users in the order that the users were created.
I want to add a unique identifier to my table which counts a user’s ‘number’ within a team retrospectively.
My users
table:
The identifier
column is the new column and I’d like to add. The first user in each…
Generate a “Hello world” larvel package in record time!
Packages are the primary way of adding functionality to Laravel. This article will get you up and running quickly with a basic package.
Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage them for you. For this tutorial you will need to have composer installed as a prerequisite. You can download composer here.
Create a new laravel project:
composer create-project — prefer-dist laravel/laravel documentrcd documentr
Open the project in your IDE.
The first thing to…
Improve tests for your laravel application
PHPUnit is a unit testing framework for the PHP programming language. Laravel has support for PHPUnit included out of the box, and a phpunit.xml
file is already set up for your application.
In your project your tests
directory will contain 2 directories: Feature
and Unit
. Unit tests are tests that focus on a very small, isolated portion of your code. In fact, most unit tests probably focus on a single method. …
When building an api, many developers will use a transformation layer that sits between the models and the JSON responses that are returned to the application’s users.
As a Laravel developer you may be familiar with packages like this https://fractal.thephpleague.com/transformers/ however Laravel now has API resources built in since version 5.5 and over time many people have switched over.
Of course you can convert models or collections to JSON using their toJson
method, however a transformer will give you more control over the JSON serialization of your models and their relationships. For example, you may want to always or sometimes…
Any application can be boiled down to CRUD functions — to use a web application a user is either creating, reading, updating or deleting records. Many times you will want to get the user to confirm if they really want to perform a particular action — like “Do you really want to delete this?”.
A modal window creates a mode that disables the main window but keeps it visible, with the modal window as a child window in front of it. Users must interact with the window before they can return to the parent application.
In this tutorial I will…
Without adding extra dependencies to your project
I found myself running into this problem recently where I had a toggle switch to display a menu — but when I clicked on another part of the page, the menu did not disappear. I realised there are libraries out there such as this one https://github.com/simplesmiler/vue-clickaway but I’d rather not pull in another dependency if I don’t have to. I thought I would share one dependency-free way to hide the menu when the user clicks away from the toggle.
In a fresh vue project I started by making a basic toggle which shows…
Tailwindcss is a utility-first CSS framework that can be composed to build any design, directly in your markup.
This is a quick tutorial to show how tailwind can be configured in a fresh Vue 3 application.
Assuming npm is installed, make sure you have the vue cli installed too:
npm install -g @vue/cli
Next, create a new vue project using the vue cli command:
vue create vue3-tailwind
Select the Vue 3 option when prompted. You can also chose Vue 2 as tailwindcss can be installed in the same way.
Now cd
into the project and run npm run serve
the…
I am a software developer and I like to write about interesting things I come across in my day to day.