PhoenixFilament.Panel.Router (PhoenixFilament v0.1.0)

Copy Markdown View Source

Provides the phoenix_filament_panel/2 router macro.

Usage

In your router:

import PhoenixFilament.Panel.Router

scope "/" do
  pipe_through [:browser]
  phoenix_filament_panel "/admin", MyApp.Admin
end

HTTP-level authentication

HTTP-level plug authentication (e.g. EnsureAuthenticated) should be configured via pipe_through in your router scope surrounding the phoenix_filament_panel call. This is the standard Phoenix pattern:

scope "/admin" do
  pipe_through [:browser, :require_authenticated_user]
  phoenix_filament_panel "/", MyApp.Admin
end

For LiveView-level auth, configure :on_mount in your panel module:

use PhoenixFilament.Panel,
  path: "/admin",
  on_mount: {MyAppWeb.UserAuth, :require_authenticated_user}

The :plug panel option is kept for documentation purposes but cannot be automatically injected by this macro due to Phoenix Router compile-time constraints. Use pipe_through in your router instead.

Summary

Functions

phoenix_filament_panel(path, panel_module)

(macro)