Laravel Responsables is a Laravel feature that lets you standardize API answers. It allows you to set an uniform response format for your API endpoints in your application. You must develop a class that implements the ‘Responsable’ interface in order to use Laravel Responsables. This class should have a toResponse function that returns an object. When […]
Send WhatsApp Messages in Laravel With Vonage’s Native SDK
To send WhatsApp messages in Laravel with Vonage’s native SDK, follow these steps: composer require vonage/client VONAGE_API_KEY=your_api_key VONAGE_API_SECRET=your_api_secret VONAGE_WHATSAPP_NUMBER=your_whatsapp_number Replace your_api_key, your_api_secret, and your_whatsapp_number with your Vonage API key, API secret, and WhatsApp-enabled phone number, respectively. Replace +1234567890 with the WhatsApp-enabled phone number of the recipient. Note that you will need to have an active […]
How to use subqueries in laravel 9
Subqueries are useful in Eloquent ORM by Laravel for a number of things. You could utilize subqueries in the following situations, for instance: Advanced filtering Subqueries can be used in a query’s where clause to filter results depending on conditions that are assessed by another query. This can be especially helpful when determining whether a […]
Tips to minimize Laravel Eloquent’s memory consumption
When utilizing Laravel Eloquent, there are a few methods you may reduce memory use: Chunk technique handle huge datasets by breaking them up into smaller chunks using the chunk technique, which eliminates the need to load the entire dataset into memory at once. Use subqueries to divide complicated inquiries into more digestible chunks, use subqueries. […]
Lazy loading vs eager loading in laravel
In Laravel, “lazy loading” and “eager loading” relate to two distinct methods of loading model relationships. To create a relationship with lazy loading in Laravel, specify the relationship on your model and then use the load method to load the relationship as needed. Here’s an example of how to use lazy loading to establish a […]
Tips to Improve Laravel Eloquent Performance with Eager loading
Eloquent performance patterns are tactics and approaches that may be used to improve the performance of an application that employs the Object-Relational Mapping (ORM) component of Laravel Eloquent to communicate with a database. Here are some pointers for enhancing a Laravel application’s speed with Eloquent: Reduce the number of database requests by using eager loading: […]
Polymorphic One of Many Relationship in Laravel
When a model is linked to a variety of different models, but depending on the circumstance, we want to connect the most recent, the oldest, or a custom model. Let’s use some code to test polymorphism one of many to check whether it works. Consider a cat owner who keeps a large number of cats, […]
Polymorphic One to One Relationship in Laravel
Polymorphic One to one When one child model belongs to more than one parent model, this is referred to as polymorphic one-to-one. Assume a cat belongs to a neighborhood and the cat owner. Let’s put some code to the test and see whether polymorphic one-to-one works. Let’s create 3 models. One is for the area, […]
Blade templating with Laravel 9
Laravel is a robust PHP web framework for building dynamic web applications. The powerful templating engine blade is provided by Laravel. With Laravel 9, released in January 2022, comes a new version of Blade, bringing with it a number of new features and improvements. One of the most significant changes in Blade templating with Laravel […]
Detail explanation of the Eloquent relationships with Laravel 8 & 9
There are different types of relationships in Laravel. We have given a detailed explanation of the eloquent relationship with Laravel One To One Eloquent Relationship An owner may have one house and that house belongs to the owner So, we have to create two model PHP artisan make: model owner -mcPHP artisan make: model house -mc […]