Laravel CRUD Application

In this tutorial, we are going to create a Laravel application with CRUD operation. In programming, create, read, update, and delete are the four basic operations of data storage. We will give you a simple example of how to perform a CRUD operation in Laravel 8. Laravel is one of the most popular PHP-based frameworks

Learn More

Database Seeding in Laravel With Example

What is Database Seeding? Database seeding is the process of seeding a database with actual or dummy data, according to Wikipedia. Seeding a database is the process of providing an initial collection of data to a database after setup. It’s especially beneficial when we need to populate the database with data that we’ll need later.

Learn More

Eloquent Accessors and Mutators in Laravel

In this Blog, we’ll understand mutators and accessors of the Eloquent ORM in the Laravel framework by examples. Laravel, Accessors, and Mutators allow us to alter data while saving and fetching. As per the name, the Accessor alters data while accessing and Mutators modify data while saving. The major difference between an accessor and a

Learn More

Laravel One to One Relationship Example

In database design, relationships are important to perform normalization. With a relationship, we can easily store, retrieve, and validate data. In the Laravel framework, Eloquent provides an easy way to work with database relationships. In this example, we create two different tables and define the relationship between them. A one-to-one relationship is a very simple

Learn More

Check Database Connection in Laravel

In this example, we will check the database connection in Laravel. Before starting to create a new Laravel application start your database services like XAMPP or WAMPP and change database credentials in the .env file. Here, we will check database is connected and get an active database name using DB helper. To check database exists

Learn More

Get SQL Query in Laravel

Sometimes we face issues in getting data or getting the wrong data. We can resolve this type of issue using row SQL queries but for that, we need to convert the eloquent queries into row queries. Laravel provides two ways to get row queries. Using Laravel Eloquent methods This method to get the query of

Learn More

Create Custom Method In Laravel Model

Working with dates, we need to display formatted dates to users and store dates in the database in a specific format. Laravel provides a few ways to implement this functionality like an accessor by defining a custom function or by converting the date every time. For this example, we will define the accessor function into

Learn More

Delete All Data From Eloquent Model

Sometimes we need to delete all the data from a table. Some tables are just to store temporary data. So we need to delete or empty the table using a specific time or event. Laravel or Eloquent has many methods from query to static from removing all records from the table like DB class with

Learn More