Save Model with related data

  • hi friends,


    I have 1 model Appointment.php with AppointmentModelTrait.php and i have Payment.php Model. So i need to save my model appointment but also save data in Payment table. Im try to do it but without success.


    In my AppointmentModelTrait.php i have a method call savePayment.


    And on my save method of AppointmentApiController.php


    Any can said me if im ok or what im doing wrong? thanks