BelongsTo#

BelongsTo is a relation to one record of another resource, belongsTo in the descriptor. It shows the target’s title and edits with a searchable picker. titleField() overrides which field names the target, and searchable() makes the list’s search match that title.

BelongsTo::to('category', CategoryResource::class)->sortable()->filterable()->searchable(),
A BelongsTo field on the product form: a picker labelled Category, showing the product's category
A BelongsTo field on the product form: a picker labelled Category, showing the product's category

BelongsTo::dependsOn(), which narrows the choices by another field, is on Forms. A filterable belongs-to takes eq ne in nin (Filter operators).

It is declared as every relation is, and takes the common modifiers too.