'Saving resources to different tables in Laravel Nova

I wonder if it would be possible to save information from one resource field to two different tables in MySQL? For example, if I am creating a new post in Laravel Nova and my code is:

public function fields(Request $request)
{
    return [
        Text::make('text one', 'text_one')->required(),
        Text::make('text two', 'text_two')->required(),
    ];
}

Would it be possible to save text_one to MySQL table1 and text_two to MySQL table2? I want both of these fields to be in the same form, and they both must create a new row on the database tables.



Solution 1:[1]

Yes it's possible, but you have to use 'Resource Hooks'. Take a look and for 'Resource Events' (Laravel model observer)

Sources

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

Source: Stack Overflow

Solution Source
Solution 1 Nikolay Stoychev