Skip to content

How to use the array to set the select options in the filamentphp? #14336

Answered by leandrocfe
HamidGj asked this question in Help
Discussion options

You must be logged in to vote
Forms\Components\Select::make('countries')
    ->options(function (): array {

        $languages = config('languages'); //your config

        return array_map(function ($language) {
            return $language['name'];
        }, $languages);

    })

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@HamidGj
Comment options

Answer selected by HamidGj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants