In this tutorial, we'll explore the power of Laravel's global scope using a practical example. We will be implementing a global scope to ensure we only retrieve posts that are set to...
Category: Database
In this tutorial, we will explore how to use a model scope with a relationship condition to filter and retrieve posts based on their comment count.
In this tutorial, you'll learn to add a model scope with parameters to filter and retrieve data. This allows you to create even more flexible query constraints.
In this guide, we'll explore how to create and use model scopes in Laravel Eloquent, using a practical example of filtering published and draft posts.
In this tutorial, you'll learn how to add a soft delete feature to your Models. We'll cover how to soft delete, restore records, or permanently delete records.
In this guide I will show you how to use a factory to create a model with a related record. This includes making migrations, models, factories and the seeder.