Unleashing the Power of JavaScript Spread Operator

JavaScript, a versatile and dynamic programming language, introduces a powerful feature known as the spread operator (…). This seemingly simple syntax is a game-changer, providing developers with concise and efficient ways to manipulate arrays, objects, and function arguments. In this blog post, I’ll explore the various use cases and benefits of the spread operator in…

Read More

Enum in PHP

Although the concept of enums is not novel in programming, PHP introduced this feature relatively recently, with its 8.1 version. Now, let’s explore the possibilities it offers. Enum in PHP is declared in this way: enum OrderStatus { case PENDING; case CONFIRMED; case SHIPPED; case DELIVERED; case CANCELLED; } So it represents a collection of…

Read More

Simple way to configure vue.js (axios, pinia) to work with Laravel Sanctum Token based auth

Laravel Sanctum gives a simple mechanism of authentication for SPAs (Single Page Applications). There are basically two ways Sanctum can be used.  1. API Tokens: Sanctum can generate token for an authenticated user and that token can be used everytime for subsequent requests.  2. SPA Authentication: For this functionality, Sanctum avoids the use of tokens…

Read More