vendredi 26 octobre 2018

laravel updating one to one relationship with model

I have 1 to 1 model (model1 <1---1>model1.0) and i have model2.0 like below:

+------+       +---------+
|      +-1---1-+model1.0 |
|model1|       +---------+
|      |                    +----------+
+------+                    |model2.0  |
                            +----------+

how do i swing from model1.0 to model 2.0? like below:

+------+       +---------+
|      |       |model1.0 |
|model1|       +---------+
|      |                    +----------+
+------+-1----------------1-|model2.0  |
                            +----------+

note:

  • model1 and model1.0 is in database but model2.0 is still in controller as object variable.

  • model1.0 and model2.0 is object of the same model class



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire