'field that displays by default the current value that comes from the API but the user should be able to change it

I have a nova field that is showing some HTML content based on some info returned from an API, so the field is like this:

Html::make('Product Name')
                ->html(function () use ($prodInformation) {
                    if (!empty($prodInformation)) {
                        return '<div>
                    <h1>Info from the API: Product Name</h1>
                    <p>' . $prodInformation['title'] . '</p>
                </div>';
                    }
                })->hideWhenCreating(),

And its working fine, it displays the proper information.

However I to have a field for SEO purposes where the user can change on the cms the default product name. So it should be a field that displays by default the current product name that comes from the API but the user should be able to change it and the value be stored on the local database. Do you know how to properly achieve that in the Nova cms?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source