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

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners