diff --git a/resources/js/Components/Pages/RecordsPage.tsx b/resources/js/Components/Pages/RecordsPage.tsx index 59caa7cc4..864644795 100644 --- a/resources/js/Components/Pages/RecordsPage.tsx +++ b/resources/js/Components/Pages/RecordsPage.tsx @@ -26,6 +26,7 @@ import { } from '../../Models'; import type { FieldT, + SelectOptionsT, SelectT, TextAreaT, TextFieldT @@ -539,4 +540,14 @@ export class RecordsPage extends Page { return list.join(''); } + + async getModelSelectOptions(model: typeof Model, labelAttribute: string): Promise { + const response = await model.all(); + const categories = response.getData(); + + return categories.map((instance: IModel) => ({ + value: instance.getId() as string, + label: instance[labelAttribute] as string + })); + } }