Enforcing Strict Mode in Eloquent Models with Model::shouldBeStrict() in Laravel

In Laravel, Eloquent models offer a convenient way to interact with databases. However, by default, they allow a certain level of flexibility that could sometimes lead to hidden issues. One way to improve debugging and maintain strict coding standards is by enabling strict mode on Eloquent models. This is where Model::shouldBeStrict() comes into play. What […]

Share To:

Create unique slug without any package in laravel

In this article, I will demonstrate the process of dynamically generating unique slugs for any models within Laravel 10. Our approach involves crafting distinctive slugs for tables existing within our Laravel application. By crafting a unified helper method and strategically invoking it, we can seamlessly generate these unique slugs. By establishing a solitary helper method […]

Share To:

Array destructuring is cool

Array destructuring is a feature in PHP that allows you to easily extract values from arrays and assign them to variables in a concise and expressive way. Instead of manually accessing individual elements of an array using their respective keys, you can directly “destructure” the array into separate variables that hold the values you need. […]

Share To:

Laravel Array Length Validation Example

Laravel Validation Array Min: When you have to validate that an array contains at least three users, you can apply the min rule: Laravel Validation Array Max: When you have to validate that an array contains more than three users, you can apply the max rule: Laravel Validation Array Between: When you have to validate […]

Share To: