https://dev.to/visuellverstehen https://dev.to/juliawarnke Usually when building a custom relationship fieldtype you want to work with data from somewhere else than statamic. In this example we extended the relationship fieldtype in order to provide a list of imported tags.

public function getIndexItems($request) { return collect($this->tags) ->filter(function ($tag) use ($request) { if (! $request->search) { return true; } return Str::contains($tag['title'], $request->search); }); }}

This could be done like this: public function getIndexItems($request) { $tags = collect($this->tags)->filter(function ($tag) use ($request) { if (! $request->search) { return true; } return Str::contains($tag['title'], $request->search); }); return $this->paginate($tags); } protected function paginate($tags): LengthAwarePaginator { $currentPage = Paginator::resolveCurrentPage(); $perPage = 50; $total = $tags->count(); $result = $total ?
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners