Home > OS >  Add a static label/text above panel
Add a static label/text above panel

Time:05-05

I have a laravel nova panel and its working fine. However I would like to have a static label/text above the panel saying "Read more section". Do you know if nova has some component or field or something to achieve that? Thanks!

  public function fields(Request $request)
        {
            return [
                ID::make(__('ID'), 'id')->sortable(),
    
                new Panel('Read more section', [                
    
                    JSON::make('Read more section', [
                        Text::make('Title')->rules(['max:255']),
                        Text::make('Description'),
                    ])  
                ]),
                
               
            ];
        }

CodePudding user response:

Found the answer here (under 'use-inside-panels', you need to scoll, link does not work)

Because you're using the JSON Wrapper, defining fields in a Panel is a bit different. Your code should be as follow:

public function fields(Request $request)
        {
            return [
                ID::make(__('ID'), 'id')->sortable(),
    
                new Panel('Read more section', [                
    
                    JSON::make('Read more section', [
                        Text::make('Title')->rules(['max:255']),
                        Text::make('Description'),
                    ])->data // <-- added data.
                ]),
                
               
            ];
        }

Please refer to the docs here: docs (under 'use-inside-panels', you need to scoll, link does not work)

  • Related