Download the PHP package abather/relation-components without Composer
On this page you can find all versions of the php package abather/relation-components. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download abather/relation-components
More information about abather/relation-components
Files in abather/relation-components
Package relation-components
Short Description column and entry for relations
License MIT
Homepage https://github.com/abather/relation-components
Informations about the package relation-components
Relation Components

Filament table columns and infolist entries for belongsTo and morphTo relationships.
Requirements
- Filament v4+
Installation
Usage
BelongsToColumn / BelongsToEntry
Pass the resource class directly to make(). All configuration is derived automatically.
Available options (all chainable):
MorphToColumn / MorphToEntry
Pass the relation name to make() and provide the type map via ->types().
N+1 warning: eager-load the relation to avoid per-row queries.
BelongsToSelect
A form select for belongsTo relationships. Pass the resource class to make() — the relation, label, and title attribute are all derived automatically.
Available options (all chainable):
Global Configuration
Since these classes extend Filament's TextColumn and TextEntry, they can be configured globally in your AppServiceProvider the same way:
Customization
Any method from TextColumn / TextEntry can be chained to override the defaults:
Authorization Visibility
By default, columns and entries are always rendered regardless of whether the current user is authorized to view the related record's page. You can change this by calling ->hideWhenNotAuthorizedToView(), which will completely hide the field if the user does not have permission to view the related resource.
When this is enabled, the visibility is determined as follows:
- If no related record is loaded yet (e.g. on a list page),
canViewAny()on the resource is checked. - If a related record is available,
canView($record)on the resource is checked.
The field is hidden entirely when the check fails — the user will not see the field at all, not just an empty value.
URL authorization: Even without
->hideWhenNotAuthorizedToView(), the link is always authorization-aware. The URL is only generated when all of the following are true: a related record exists, the target page exists on the resource, andcanView($record)passes. If the user is not authorized to view the record, the field renders as plain text with no link.
Visibility on Parent Pages
By default, columns and entries are automatically hidden when shown inside the related resource's own relation manager pages. For example, a UserResource column will be hidden on any of User's relation manager pages.
To override this behavior, chain ->hiddenOn([]):