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

Error with nova tabs #39

Open
AppDevXXX opened this issue Jan 4, 2024 · 0 comments
Open

Error with nova tabs #39

AppDevXXX opened this issue Jan 4, 2024 · 0 comments

Comments

@AppDevXXX
Copy link

Package:
composer require shuvroroy/nova-tabs

Requirements
PHP (^8.1 or higher)
Laravel Nova (^4.12 or higher)

The problem only appears when I use Tabs.
The information is saved in the database but the following error appears when saving:
Attempt to assign property "name" on null.

My model:

public $translatable = [
    'name'
];

public static function initializeTranslations()
{
    $articleCategory = new ArticleCategory;

    $articleCategory
       ->setTranslation('name', 'en', 'Name in English')
       ->setTranslation('name', 'fr', 'Nom en Français')
       ->save();
}

My Nova resource:

public function fields(NovaRequest $request)
{
    return [
        ID::make()->sortable(),

        Tabs::make('General', [
            Tab::make('Main Information', [
                NovaTabTranslatable::make([
                    Text::make('Name', 'name')
                        ->rules('required'),
                ]),
            ]),
            Tab::make('Other', [
                Boolean::make('Active', 'active'),
            ]),
        ]),
    ];
}
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

1 participant