Filament Nested Resources: Managing Courses and Lessons | Mohamed Said       [Skip to content](#main)  [ ![](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png) Mohamed SaidLaravel Backend Engineer ](https://www.msaied.com/public) - [Home](https://www.msaied.com/public)
- [Projects](https://www.msaied.com/public/projects)
- [Articles](https://www.msaied.com/public/articles)
- [Certificates](https://www.msaied.com/public/certificates)
- [About](https://www.msaied.com/public#about)

           [  Contact](https://www.msaied.com/public#contact) Menu 

Menu
----

Close 

 - [HomeStart here](https://www.msaied.com/public)
- [ProjectsCase studies](https://www.msaied.com/public/projects)
- [ArticlesEngineering notes](https://www.msaied.com/public/articles)
- [CertificatesCredentials](https://www.msaied.com/public/certificates)
- [AboutHow I work](https://www.msaied.com/public#about)
- [ContactGet in touch](https://www.msaied.com/public#contact)

  [Start a conversation](https://www.msaied.com/public#contact) [WhatsApp](https://wa.me/201094619204) [Email](mailto:hello@msaied.com) 

 1. [Home](https://www.msaied.com/public)
2. /
3. [Articles](https://www.msaied.com/public/articles)
4. /
5. [Laravel](https://www.msaied.com/public/articles?category=laravel)
6. /
7. Filament Nested Resources: Managing Courses and Their Lessons

   [Laravel](https://www.msaied.com/public/articles?category=laravel) 

 Filament Nested Resources: Managing Courses and Their Lessons
==============================================================

 Learn how to implement nested resources in Filament for managing related data, such as courses and their lessons, enhancing your Laravel application's admin panel.

 ![](https://cdn.msaied.com/01M22N44A70A5MC2S599JP0MPH.webp) [Mohamed Said](https://www.msaied.com/public#person) Published 31 Oct 2023 · Updated 11 Jun 2026 · 2 min read

ShareCopy linkCopied

 ![Filament Nested Resources: Managing Courses and Their Lessons](https://cdn.msaied.com/94/7b6737a1d481f958c0407ddc5fa35fee.png) 

  On this page +1. [Understanding Nested Resources](#understanding-nested-resources)
2. [Preparing the Lesson Resource](#preparing-the-lesson-resource)
3. [Adding an Action to the Course Resource](#adding-an-action-to-the-course-resource)
4. [Customizing the Create Lesson Action](#customizing-the-create-lesson-action)
5. [Takeaways](#takeaways)

 Managing hierarchical data within an administration panel is a common requirement for many web applications. For Laravel developers using Filament, implementing nested resources can significantly improve the user experience by allowing direct management of related records. This tutorial demonstrates how to set up nested resources in Filament, using the example of managing Courses and their associated Lessons.

Understanding Nested Resources
------------------------------

In Laravel, nested resources refer to the relationship where one resource controller is nested within another. For instance, a Lesson is typically associated with a Course, making it a nested resource. Filament provides a straightforward way to integrate this concept into its admin panel.

Our goal is to achieve the following:

1. From the list of courses, provide a direct link to manage the lessons for each specific course.
2. The lesson management page should clearly display the parent course's title and include breadcrumbs that reflect this hierarchy.

Preparing the Lesson Resource
-----------------------------

To enable nested resource management, we need to configure the LessonResource. Several key adjustments are necessary:

- Define a new route slug: We'll set a specific slug for the LessonResource to indicate its nested nature, such as courses/lessons.
- Prevent navigation registration: Since lessons are managed within the context of a course, the LessonResource itself shouldn't appear as a top-level item in the Filament navigation.
- Modify the getEloquentQuery(): This is crucial for filtering lessons to show only those belonging to the currently selected course. We'll use the record parameter from the request.
- Adjust getPages(): We need to define custom routes for listing, creating, and editing lessons, ensuring they accept the parent record parameter.

Here's the configuration for app/Filament/Resources/LessonResource.php:

```php
