Laravel
How to Mock Objects in PHPUnit / PEST tests in Laravel
I always dreaded learning about Mocking in testing assuming it would be something too complex, and I never really had the requirement of using Mocking in my Laravel tests. But now since I have a ba...
Fix styling and formatting of Blade files using Github Actions and Blade Formatter
Introduction Since we are looking into the foundations of working in a team, which also includes defining a set of rules for formatting files. In the previous article, we discussed Fixing the st...
Update MySQL JSON column fields in Laravel
If you have a JSON column in your migrations, and you are looking to update the value of one of its fields. Here is how you can do it $booking->update([ 'stripePayment->paymentStatus...
Populate Select Box with Model Data using Eloquent Pluck method
In this tutorial we will see the use of Eloquent Pluck method to fetch specific key values from model and populate values into Select box. pluck() method is for Laravel Collection and more frequent...
Fix styling and formatting of PHP files using Github Actions and Laravel Pint
Introduction While working on a team consisting of multiple developers, it's really important to have a predefined set of rules about different aspects of the project. Whether it is about the authori...
How to append new attributes to eloquent model
Here we will see how we can add a new attribute in an eloquent model. Sometimes When converting models to arrays or JSON,we require additional information based on some calculation/manipulation on...
Guide to work with migrations of a live project in Laravel
Introduction Database Migrations in Laravel provide a convenient way to interact with the database and help us properly structure our database, so working with the migrations and database is quite si...
Artisan down and maintenance page customisation in Laravel
Here we will see the maintenance mode and maintenance page customization in Laravel in details. We often require maintenance to be done for our project. Laravel provides easy commands for the sam...
Multiple "And" and "OR where" clauses in eloquent query
In this article we will take a look on how we can build SQL queries with multiple 'AND' and 'OR' where statements using Eloquent ORM. Let first start with the simple Where Clauses You may use the...