Laravel Eloquent where the field is null or Not null

In this post, we gonna look at using Laravel’s Eloquent ORM and Query Builder methods to query data from the database where the field is null and where the field is not the null scenario. Check if null: whereNull […]

How to Connect to MySQL database in Slim framework 4

Defining MySQL database connection in the Slim 4 framework is pretty simple. In this slim framework 4 tutorial, we gonna create a project with Slim-Skeleton. If you are looking for Slim Framework 3, follow the link How […]

How to Import and Export MySQL Databases

Export Database To export a database, open up the terminal, making sure that you are not logged into MySQL, and execute the below command with database details.

The selected database in […]

PHP 8 – Nullsafe operator

The operator nullsafe allows a developer to eliminate the null check for each property before going onto the next chain of the property or method. It is very common to only want to call a method or fetch a property on […]

Custom Helper functions in Laravel

In this post, we gonna create custom functions and load it in the Laravel project. These functions can be accessible all over the project. Loading custom helper functions in Laravel is pretty straightforward. Let’s […]

Remove Empty Array Elements and reindex in PHP

The built-in array_filter() the function removes all the empty elements, zeros, false and null values from an array. This function uses a callback function to filter the array values. If no callback function is specified, […]

PHP 7.4 – Null coalescing assignment operator

The null coalescing assignment operator is a shorthand for null coalescing operations. Let’s take a example code

So, instead of writing the previous code, we could write the following: […]

PHP 7.4 – Arrow functions

Arrow functions also called “short closures”. We can always access the parent scope, there’s no need for the use keyword. Here is a simple example with an arrow function.

[…]

Eloquent – A better way to increment or decrements an int

Laravel has in-built increment() and decrement() functions to increase or decrease a value of the column, by 1 or with the given number. Below are the examples:

That’s it – it will […]
DMCA.com Protection Status