[Vuejs]-Adding Data to Belongs to resource using TextField laravel Nova

0👍

You can do that inside your model, you need to override the save function:

public function save(array $options = array()) {
    parent::save($options);
}

please note that in order to link your current model to another one, you need to do so after this line parent::save($options); since you can’t get the $this->"primary_key" of the current record before actually saving the model in the database

ex:

class Student
{
    public function save(array $options = array()) {

        $user = new User();
        $user->property1 = '';
        $user->property2 = '';
        $user->save();

        parent::save($options);

        //Here you can get the $this->studentid
        //Or the $user->userid

    }
}

Leave a comment