Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Filament Relation Pages Laravel Package

gheith3/filament-relation-pages

Filament Relation Pages lets you add fully custom, free-form tabs alongside Relation Managers in any resource—no forced table or relationship. Build pages with Filament schema components, Blade/HTML, Alpine.js, and more. Includes an artisan generator.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Highly aligned with Filament’s ecosystem: The package extends Filament’s native RelationManager pattern, leveraging its HasRelationManagers trait and Livewire integration. This ensures seamless integration without requiring custom panel or middleware changes.
  • Minimalist design: The abstract RelationPage class abstracts away boilerplate, allowing developers to focus on custom UI logic (e.g., schemas, Blade views, or Alpine.js) while adhering to Filament’s conventions.
  • Schema-first approach: By leveraging Filament’s InteractsWithSchemas trait, the package enables dynamic schema generation (e.g., content(Schema $schema)), reducing redundancy for common UI patterns (e.g., infolists, forms).

Integration Feasibility

  • Zero-configuration for basic use: Auto-discovery via Laravel’s service provider eliminates manual setup, reducing friction for adoption.
  • Artisan scaffolding: The make:filament-relation-page command generates both PHP and Blade files, accelerating development cycles. Custom stubs further enable team-specific templates.
  • Backward/forward compatibility: Supports Filament v4/v5 and Laravel 12/13, with clear upgrade paths for future versions. The package’s reliance on Filament’s static method contract (canViewForRecord, getTabComponent) minimizes breaking changes.

Technical Risk

  • Filament version lock-in: Tight coupling to Filament’s internal methods (e.g., HasRelationManagers) could pose risks if Filament changes its API. However, the package’s minimal surface area (3 static methods) mitigates this.
  • Livewire dependency: Requires familiarity with Livewire’s data binding and lifecycle hooks (e.g., #[Locked] properties). Developers unfamiliar with Livewire may need ramp-up time.
  • Performance implications: Lazy-loading ($isLazy = true) improves initial load times but may introduce latency for first-time tab access. Testing with large datasets is recommended.
  • Customization depth: While the package supports Blade, Alpine.js, and Filament schemas, complex interactions (e.g., real-time updates) may require additional JavaScript or Livewire logic.

Key Questions

  1. Use Case Alignment:
    • Does the team frequently need custom, non-tabular UI alongside relation managers (e.g., dashboards, wizards, or multi-step forms)?
    • Are there existing Filament resources where this would replace or augment RelationManager tables?
  2. Team Expertise:
    • Is the team proficient with Filament schemas and Livewire? If not, additional training or documentation may be needed.
    • Are developers comfortable with Blade templating and Alpine.js for custom UI?
  3. Scalability:
    • How many relation pages per resource are anticipated? Performance testing may be needed for >10 tabs/resource.
    • Will relation pages include real-time data (e.g., WebSocket updates) or heavy computations (e.g., API calls)?
  4. Maintenance:
    • Who will own the custom stubs and Blade templates? Will they be version-controlled separately?
    • How will the team handle Filament upgrades? Will the package’s compatibility be monitored?
  5. Alternatives:
    • Could existing Filament features (e.g., RelationManager customization, HasActions) achieve similar goals with less overhead?
    • Are there other packages (e.g., Spatie’s laravel-activitylog for audit tabs) that could complement this?

Integration Approach

Stack Fit

  • Primary Stack: Laravel 12/13 + Filament v4/v5 + Livewire.
  • Secondary Stack: Supports Blade, Alpine.js, and Filament’s schema components (e.g., Infolists, Forms). No additional PHP extensions or JavaScript frameworks are required.
  • Database: No direct database interactions are enforced, but relation pages can query the ownerRecord or related models.

Migration Path

  1. Assessment Phase:
    • Audit existing Filament resources to identify candidates for relation pages (e.g., resources with complex related data that doesn’t fit a table).
    • Benchmark performance with lazy-loading enabled/disabled for high-traffic resources.
  2. Pilot Implementation:
    • Start with a single resource (e.g., Buildings) to test the make:filament-relation-page command and customization workflow.
    • Validate integration with existing RelationManager tabs and actions.
  3. Rollout:
    • Gradually replace or supplement RelationManager tables with relation pages where appropriate.
    • Publish custom stubs to standardize generation across the team.
  4. Deprecation:
    • Phase out legacy custom tabs or panels that duplicate relation page functionality.

Compatibility

  • Filament Plugins: Works alongside other Filament plugins (e.g., filament-spatie-media-library) as long as they don’t conflict with getRelations().
  • Multi-Panel Apps: Supports Filament’s panel system (e.g., --panel=admin flag in the Artisan command).
  • Third-Party Packages: No known conflicts with popular Laravel packages (e.g., Spatie, Laravel Nova). However, test with packages that modify Filament’s RelationManager behavior.
  • Legacy Code: Minimal risk to existing codebases, as relation pages are opt-in and don’t modify core Filament logic.

Sequencing

  1. Prerequisites:
    • Ensure the Laravel/Filament stack meets the package’s requirements (PHP 8.2+, Filament v4/v5).
    • Install the package via Composer:
      composer require gheith3/filament-relation-pages
      
  2. Development:
    • Generate a relation page:
      php artisan make:filament-relation-page SummaryPage --resource=Buildings
      
    • Customize the PHP class and Blade view. Example workflow:
      • Use content(Schema $schema) for Filament components.
      • Use Blade for custom HTML/Alpine.js.
      • Add dynamic logic (e.g., canViewForRecord, getBadge).
  3. Testing:
    • Verify tab visibility, lazy-loading, and schema rendering.
    • Test edge cases (e.g., hidden tabs, dynamic badges).
  4. Deployment:
    • Register the relation page in the resource’s getRelations() method.
    • Monitor performance and user adoption.

Operational Impact

Maintenance

  • Package Updates:
    • Monitor the changelog for Filament compatibility changes.
    • Test updates in a staging environment before production deployment.
  • Custom Code:
    • Relation pages are application code, so they follow the team’s existing maintenance processes (e.g., PR reviews, testing).
    • Document custom stubs and Blade templates in the codebase (e.g., README.md in the resource directory).
  • Dependencies:
    • No external dependencies beyond Filament/Laravel. Internal dependencies (e.g., shared services) should be injected via constructor or methods.

Support

  • Troubleshooting:
    • Common issues:
      • Tab not appearing: Verify getRelations() includes the page class and canViewForRecord returns true.
      • Lazy-loading delays: Check network requests or query performance.
      • Schema errors: Ensure methods like content(Schema $schema) return valid schemas.
    • Debugging tools:
      • Filament’s wire:log for Livewire data.
      • Laravel’s dd($this->ownerRecord) in the relation page class.
  • Documentation:
    • The package’s README is comprehensive but may require internal supplements (e.g., team-specific examples).
    • Create a runbook for:
      • Generating and customizing relation pages.
      • Handling common edge cases (e.g., permissions, dynamic data).

Scaling

  • Performance:
    • Lazy-loading: Reduces initial load time but may increase latency for first-time tab access. Test with realistic data volumes.
    • Schema complexity: Avoid overly nested schemas in high-traffic resources (e.g., >100 related records).
    • Database queries: Offload heavy computations to background jobs or cache results (e.g., ->remember(3600)).
  • Concurrency:
    • Livewire handles concurrent requests per-tab, but test with multiple users accessing the same relation page simultaneously.
    • For write-heavy pages, consider adding #[Locked] properties to prevent race conditions.
  • Resource Limits:
    • Monitor memory usage if relation pages include large datasets or complex schemas. Optimize with pagination or lazy-loading.

Failure Modes

Failure Scenario Impact Mitigation
Tab fails to render Broken UI, user confusion Add @error directives in Blade and validate content(Schema $schema) returns a valid schema.
Lazy-loaded tab times out Poor UX, abandoned workflows Set reasonable timeouts or preload critical data.
ownerRecord is
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
daikazu/eloquent-salesforce-objects
unseen-codes/chat
romalytar/yammi-jobs-monitoring-laravel
kisame76/filament-db-table-state
nqxcode/laravel-lucene-search
dpfx/laravel-livewire-wizards
workos/workos-php-laravel
sofa/laravel-global-scope
nawasara/auth-primitives
adhocrat-io/arkhe-main
make-dev/orca-harpoon
itsemon245/lamet
baks-dev/dashboard
amoifr/pickle-panther-bundle
make-dev/orca
dmstr/symfony-system-resources-bundle
dmstr/symfony-job-queue-bundle
dmstr/openapi-json-schema-bundle
dmstr/keycloak-security-bundle
dmstr/doctrine-audit-log-bundle