© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•9mo ago•
17 replies
Majid Al Zariey

V4 Nested Resources

Has anybody started using nested resources in version 4 once I try accessing the nested list I get 404

Parent Resource
    protected static ?string $model = ReviewProgram::class;
    
    public static function table(Table $table): Table
    {
        return $table
            ->columns([
                TextColumn::make('name')
                    ->searchable()
                    ->sortable(),
            ])
            ->actions([
                Action::make('sections')
                    ->authorize(\Auth::user()->can('viewReviewSection', ReviewProgram::class))
                    ->color('success')
                    ->icon('heroicon-m-academic-cap')
                    ->url(
                        fn ($record):string => ReviewSectionResource::getUrl('index',[
                            'review-program' => $record,
                        ])
                    ),
            ])
          
            ->recordAction('sections');
    }

    public static function getPages(): array
    {
        return [
            'index' => Pages\ListReviewPrograms::route('/'),
            'edit' => Pages\EditReviewProgram::route('/{record}/edit'),
        ];
    }
    protected static ?string $model = ReviewProgram::class;
    
    public static function table(Table $table): Table
    {
        return $table
            ->columns([
                TextColumn::make('name')
                    ->searchable()
                    ->sortable(),
            ])
            ->actions([
                Action::make('sections')
                    ->authorize(\Auth::user()->can('viewReviewSection', ReviewProgram::class))
                    ->color('success')
                    ->icon('heroicon-m-academic-cap')
                    ->url(
                        fn ($record):string => ReviewSectionResource::getUrl('index',[
                            'review-program' => $record,
                        ])
                    ),
            ])
          
            ->recordAction('sections');
    }

    public static function getPages(): array
    {
        return [
            'index' => Pages\ListReviewPrograms::route('/'),
            'edit' => Pages\EditReviewProgram::route('/{record}/edit'),
        ];
    }


Nested Resource
    protected static ?string $model = ReviewSection::class;

    protected static ?string $parentResource = ReviewProgramResource::class;

    public static function getPages(): array
    {
        return [
            'index' => ManageReviewProgramSections::route('/'),
        ];
    }
    protected static ?string $model = ReviewSection::class;

    protected static ?string $parentResource = ReviewProgramResource::class;

    public static function getPages(): array
    {
        return [
            'index' => ManageReviewProgramSections::route('/'),
        ];
    }

ManageReviewProgramSections

    protected static string $resource = ReviewSectionResource::class;

    protected static string $relationship = 'reviewSections';

    protected static ?string $relatedResource = ReviewProgramResource::class;

    public function table(Table $table): Table
    {
        return $table
            ->headerActions([
                CreateAction::make(),
            ]);
    }
    protected static string $resource = ReviewSectionResource::class;

    protected static string $relationship = 'reviewSections';

    protected static ?string $relatedResource = ReviewProgramResource::class;

    public function table(Table $table): Table
    {
        return $table
            ->headerActions([
                CreateAction::make(),
            ]);
    }
Solution
I think you should add to it the parent resource

public static function getPages(): array
{
    return [
        'index' => Pages\ListReviewPrograms::route('/'),
        'edit' => Pages\EditReviewProgram::route('/{record}/edit'),
        'sections' => ManageReviewProgramSections::route('/{record}/sections'),
    ];
}
public static function getPages(): array
{
    return [
        'index' => Pages\ListReviewPrograms::route('/'),
        'edit' => Pages\EditReviewProgram::route('/{record}/edit'),
        'sections' => ManageReviewProgramSections::route('/{record}/sections'),
    ];
}
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Nested resources & policies
FilamentFFilament / ❓┊help
4mo ago
Multiple nested resources
FilamentFFilament / ❓┊help
2y ago
Route in Nested Resources
FilamentFFilament / ❓┊help
3y ago
Nested slideOuts scrollable in V4
FilamentFFilament / ❓┊help
5w ago