Skip to content

Mohcin Bounouara

Thoughts about software engineering and life

Handling Date Fields. A Common Pitfall

In my Laravel hobby project, I had a field called date_covered defined as a date type, with now() as the default value. However, when I needed to manipulate this field, for example, displaying a range like 02.12.2023 – 02.11.2024—it became clear that a single date column wasn’t ideal. Using date works fine when storing a Continue reading “Handling Date Fields. A Common Pitfall”

Synchronous and Asynchronous code by simple examples

In software development, there are two important concepts: synchronous and asynchronous behavior. JavaScript developers, especially those who use vanilla JavaScript, know these well because of how promises work. I like to explain things in a simple way, so it’s easier for me and others to understand new topics. Synchronous Programming Let’s imagine you went to Continue reading “Synchronous and Asynchronous code by simple examples”

Fixing Object Pagination with Laravel and Inertia.js that gives empty data

Problem When working with Laravel and Inertia.js, pagination returns an object instead of an array. This can make looping over the results a bit tricky, as the expected array structure isn’t accessible. For example, in a typical Laravel controller method like this: You might see the data coming through correctly as a prop in your Continue reading “Fixing Object Pagination with Laravel and Inertia.js that gives empty data”

Understanding Method Spoofing in Laravel

Title: Understanding Method Spoofing in Laravel When working with request/response methods, different HTTP methods like GET, POST, PUT, and PATCH have custom purposes. POST is generally used for creating resources, while PUT and PATCH are intended for updates. But as a developer, you’ll often see POST used for updates too. This happens due to browser Continue reading “Understanding Method Spoofing in Laravel”