Skip to content
Agentmart
Submit a tool

filament-nested-resource

Aplicar quando criar Resource Filament v5 filho acessado por URL aninhada ao Resource pai.

Skill by coringawc

IndexedMIT
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/coringawc-filament-nested-resource

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Aplicar quando criar Resource Filament v5 filho acessado por URL aninhada ao Resource pai.

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/filament-nested-resource

What's inside

Skill name
filament-nested-resource
Description
Aplicar quando criar Resource Filament v5 filho acessado por URL aninhada ao Resource pai.
License
MIT
Metadata
author: coringawc · version: 2.0.0
Instructions
154 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Filament Nested Resource

## Consistency First

Nested resource é Resource filho com páginas próprias dentro do contexto de um Resource pai (`/projetos/{project}/colaboradores/{record}`). Use quando create/view/edit do filho precisam ser **páginas completas com URL própria**, não modais nem tabs. Para gerenciar coleção relacionada sem CRUD completo separado, use `filament-relation-page`. Para tab dentro de Edit sem URL, use RelationManager (não esta skill). O filho registra o pai via `ParentResourceRegistration` e acessa o pai pelas pages via `$this->getParentRecord()`.

## Quick Reference

- Criar com `vendor/bin/sail artisan make:filament-resource <Child> --panel=<panel> --no-interaction` e ajustar manualmente para nested (gerador nem sempre cobre).
- Resource filho: `protected static bool $shouldRegisterNavigation = false;` (acesso só via pai).
- Slug do filho em pt_BR: `protected static ?string $slug = 'colaboradores';`.
- Parent registration via `getParentResourceRegistration()` com `relationship()` + `inverseRelationship()` explícitos.
- URL gerada: `/<parent-slug>/{<parent-param>}/<child-slug>/...`.
- Nome do parâmetro do pai = inverse relationship em snake singular: `inverseRelationship('project')` → `{project}`.
- Em pages do filho, sempre `$this->getParentRecord()`. Nunca `request()->route()`.
- `$recordRouteKeyName` (slug/uuid): declarar no Resource pai E no filho consistentemente.
- Path canônico: `app/Filament/<Panel>/Resources/<Child>s/<Child>Resource.php`.

## Workflow

- [ ] Confirmar pai, filho, relationship, inverse relationship, painel e route keys antes de scaffolding.

- [ ] Gerar Resource base via Sail:

```bash
vendor/bin/sail artisan make:filament-resource ProjectCollaborator --panel=app --no-interaction
```

- [ ] No Resource filho, registrar pai e ocultar navegação global:

```php
use App\Filament\App\Resources\Projects\ProjectResource;
use Filament\Resources\ParentResourceRegistration;
use Filament\Resources\Resource;

class ProjectCollaboratorResource extends Resource
{
    protected static ?string $slug = 'colaboradores';

    protected static bool $shouldRegisterNavigation = false;

    public static function getParentResourceRegistration(): ?ParentResourceRegistration
    {
        return ProjectResource::asParent()
            ->relationship('collaborators')
            ->inverseRelationship('project');
    }
}
```

- [ ] Quando o nome inferido bate exatamente, `protected static ?string $parentResource = ProjectResource::class;` resolve. Use `getParentResourceRegistration()` se precisar fixar `relationship()`/`inverseRelationship()` sem ambiguidade.

- [ ] Definir pages com rotas relativas ao child slug. O prefix do pai é aplicado pelo Filament:

```php
public static function getPages(): array
{
    return [
        'create' => Pages\CreateProjectCollaborator::route('/incluir'),
        'view' => Pages\ViewProjectCollaborator::route('/{record}'),
        'edit' => Pages\EditProjectCollaborator::route('/{record}/editar'),
    ];
}
```

- [ ] Nas pages, acessar o pai via API Filament e proteger com tipagem:

```php
use App\Models\Project;
use Filament\Resources\Pages\CreateRecord;

class CreateProjectCollaborator extends CreateRecord
{
    protected static string $resource = ProjectCollaboratorResource::class;

    public function getTitle(): string
    {
        return __('Add collaborator to :project', [
            'project' => $this->getParentProject()->name,
        ]);
    }

    private function getParentProject(): Project
    {
        $project = $this->getParentRecord();

        if (! $project instanceof Project) {
            abort(404);
        }

        return $project;
    }
}
```

- [ ] Gerar URL manual passando o parâmetro do pai pelo nome derivado da inverse relationship:

```php
ProjectCollaboratorResource::getUrl('view', [
    'project' => $project,
    'record' => $collaborator,
], panel: 'app');
```

- [ ] Customizar route key apenas quando necessário (uuid/slug público). Aplicar no pai E no filho:

```php
protected static ?string $recordRouteKeyName = 'uuid';
```

Atualizar model (`getRouteKeyName()`), policies e asserts de URL em testes.

- [ ] Adicionar cada label nova em `lang/pt_BR.json` conforme `.agents/skills/translation/rules/translation-rules.md` §8.

- [ ] Cobrir com Pest: listagem pelo pai, create/view/edit do nested, URL com parâmetro do pai, isolamento multi-tenant.

```php
livewire(ViewProjectCollaborator::class, [
    'project' => $project->getRouteKey(),

From CoringaWc/ai-first-kit, MIT.

More from CoringaWc/ai-first-kit

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
May 26, 2026 (5 months ago)

From GitHub (fetched Oct 24, 2026).

Details

Version
2.0.0
License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from coringawc

Cite this page

filament-nested-resource skill. Agent Mart. https://agentmart.dev/skills/coringawc-filament-nested-resource (last updated 2026-10-24)