Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom display name, Different column to display not showing #121

Open
amitsingh9thjan opened this issue Jul 26, 2022 · 2 comments
Open

Comments

@amitsingh9thjan
Copy link

NovaBelongsToDepend::make('Shows', 'shows', \App\Nova\Shows::class)
->placeholder('-- Select Show --') // Add this just if you want to customize the placeholder
->options(Shows::all())
->display(function($shows){
return $shows->title . ' - ' . $shows->en_title;
}),

I'm trying this but it's not showing display attribute content.

@ikramooe
Copy link

ikramooe commented Sep 7, 2022

any solution i'm having the same problem

@mageto
Copy link

mageto commented Jan 19, 2023

You can try to map the array like below and see if it works for you.

->optionsResolve(function ($shows) {

             return $shows->get(['title', 'en_title'])
                                
               ->pluck('title', 'en_title')
                                    
               ->map(function($title, $key) {
                                    
                     return ['title' => $key, 'en_title' => $key . ' - ' . $en_title];
                                        
               })
                                    
               ->values()
                                    
                ->toArray();
                                    
           })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants