This guide will show you how to clone models, with or without relationship data. I'll also include a practical example of cloning a "Project" and "Task" model.
Category: Database
This article will explore several methods to get the last insert ID in Laravel, by using Eloquent models, the DB facade, or by accessing the PDO instance.
In this post, you'll learn how to use a many-to-many polymorphic relationship to apply data of a "Tag" model to both "Post" and "Video" models.
This blog post will show how to define and query a One-to-Many Polymorphic Relationship. We will build an example that stores comments for posts or videos.
Using Extra Fields in Pivot Table With Laravel belongsToMany
This tutorial will show you how to use a pivot with an extra field to store and access a value, like the quantity of a product in an order.
By default Laravel adds created_at and updated_at timestamps. This tutorial shows how to make models and migrations which use only created_at.