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

Remove the Passport Package in Laravel

Laravel Passport API authentication is one of the best API authentication packages but sometimes we are required to use other authentication systems like Sanctum or JWT after using Laravel. Then it required removing Laravel’s passport completely. We can directly change the package but it will hold file memory and database table with it. Eventually, it

Learn More

Check Laravel Version in CLI and File

Laravel is a popular framework built with PHP. While working on an existing project or implementing new packages we need to check particular package is compatible with the Laravel framework’s version or not. We have to decide based on the Laravel version. In this tutorial, we will teach you how to check the Laravel framework’s

Learn More

Add or Minus Years from Carbon Date in Laravel

The best part of Laravel is it has a variety of open-source plugins available. One of them is Carbon. Carbon is a date-time package for Laravel or any other PHP-based framework. In this blog, we will see some practical examples to add or remove years from carbon date objects. Carbon provides a function for adding

Learn More

Laravel File Download and Upload

Nowadays, File upload and download functionality is almost mandatory. Laravel provides simple and easy ways to upload and download files. You can store these files in a public folder or local storage. In this blog, we will see some practical examples to upload and download files in Laravel. Here, we have used Test Controller and

Learn More

How to Use & Integrate CKEditor in Laravel?

In this tutorial, we are going to create a new Laravel application for creating blogs or posts. While creating a blog we’ll use CKEditor to take input or HTML input and store it in our database. Before starting, let’s understand why CKEditor is useful compared to HTML elements like text-area or inputs. The CKEditor is

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