Laravel Eloquent ORM (Object-Relational Mapping) is a key feature of the Laravel framework, providing an elegant way to interact with your database. With Eloquent, each table in your database corresponds to a model, allowing you to work with data using…
Category: Laravel
Routing in Laravel(Laravel Routes)
Routing in Laravel serves as a fundamental aspect of directing HTTP requests to the appropriate application logic. It facilitates the mapping of URIs to controller actions, providing a clear structure for handling incoming requests. Basic Routing In Laravel, routing is…
How to check If Database Table Column Exists in Laravel Migration
In this short Laravel tutorial you will learn how to do a Laravel migration check to see if a column exists in a database table. By doing this migration check you can avoid a fatal error such as the following…
2 methods to check if a given Date is Today’s Date in Laravel
In this tutorial I will show you two days to check if a given date is today’s date in Laravel. These 2 methods are isToday method and isSameDay method of Carbon library class in Laravel. First Method: Using IsToday() In…
Example of Eloquent Model Query with conditional Where condition in Laravel
In this example I will show you how to build an Eloquent query to filter results by certain field or fields of a table. In this example we will use simple Laravel Eloquent Model example to search a table and…
How to validate exact words in an input value in Laravel?
Validate exact words: This post will show you how to validate a string by exact matching with a string. For example you have to validate a field for whether it has yes or no in an input. So the input…
How to Export and Download CSV file without Plugin in Laravel 8/9/10
In this article, we will see how to export and download CSV file in Laravel framework. Exporting CSV file is a common requirement in many applications. Most of the examples around there were based on Laravel extensions so using this…
How to validate data in Laravel, A Form Request Validation example for Laravel 7/8/9/10
In this simple tutorial I will show you an example of how to perform form request validation using Laravel’s Validator Facade. What is FormRequest? FormRequest is Laravel’s default form request validation mechanism. FormRequest can be extedned to define your custom…
Laravel Carbon addMinutes() | Laravel Carbon Add Or Subtract Minutes and Hours Examples
Laravel has the Carbon dependency attached to it. So, in order to perform basic to complex date and time calculations you can use this dependency. In this tutorial we will see some examples of addMinute and addMinutes methods of Carbon class.…
How to Remove Appends Attributes from Laravel Eloquent Model
In Laravel the set{Attribute}Attribute accessor methods are used to set new attributes in a model. For example, we do use $appends property to create our popular “full_name” attribute to combine “first_name” and “last_name” attributes. Following the syntax to define $appends…