Amit Merchant

Amit Merchant

A blog on PHP, JavaScript and more

  • Articles
  • Projects
  • Uses
  • Art
  • About
Laravel PHP JavaScript Git Misc.

Fetch count of records for children relationships in Laravel Eloquent

August 20, 2020 — There comes a time when you want to fetch the number of records for a child relationship along with the main Eloquent query.

Read More ⟶

The difference between for...in & for...of in JavaScript

August 19, 2020 — There are two ways of many using which you can loop over the iterables in JavaScript.

Read More ⟶

Insert mass database records using model factories in Laravel

August 17, 2020 — One of the many ways using which you can insert records (or seed your database) is by using the seeder classes which extend a base class called Illuminate\Database\Seeder in Laravel.

Read More ⟶

Making my VS Code minimal and distraction-free

August 14, 2020 — Before proceeding on describing all the customizations I made, I have a confession to make.

Read More ⟶

Live reload local Jekyll site in browser on file changes

August 13, 2020 — The other day, I was looking for a way using which I can reload my local Jekyll instance every time I make some changes into the files.

Read More ⟶

Expose your local websites to the internet using this open source tool in PHP

August 12, 2020 — Recently, I’ve been working on a Laravel app and one of my friends wanted to see it in action who’s sitting seven ocean apart. But, I didn’t have an actual server to host it and to make it accessible for my friend. And so, I was looking for a tool/API which can expose my local website instance to the internet.

Read More ⟶

Accessing private methods and properties outside of class using reflection in PHP

August 11, 2020 — In PHP, the visibility of a property, a method, or a constant can be defined by prefixing the declaration using keywords public, protected or private. Here is how these modifiers work.

Read More ⟶

How to group where constraints in Laravel Eloquent

August 10, 2020 — When writing MySQL queries, if there are more than two where conditions, you’d want to group certain constraints/conditions to avoid unexpected behavior. For instance, check the following query.

Read More ⟶

How to create a two column layout using Flexbox in CSS

August 9, 2020 — This blog has got this two-column layout which houses host of different things for different purposes. A two-column layout is especially useful if you want to repeat a certain column on every page.

Read More ⟶

Set default value for attributes in components using @props directive in Laravel

August 8, 2020 — As I described in this article on how you can create anonymous components in Laravel, we can create an <x-alert> component with the following content.

Read More ⟶
« Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 Next »

Newsletter

Follow me elsewhere

Recently Published

  • The query builder's sole() method to validate multiple records in Laravel 8.x

  • A little known artisan command that can inspire you

  • How to prevent overlapping of jobs in Laravel

  • Difference between React.Component and React.PureComponent

  • Deep copying objects using JSON.stringify and JSON.parse

Previous page Next page
© 2020 Amit Merchant About Contact Categories