jeudi 4 mai 2017

How to add data to realative table laravel?

I have model Object with relationship:

 public function category(){
   return $this->hasOne('App\FieldCategoriesValues');
 }

How to add new value to category?

I tried:

$object = new Object();
$object->category()->save(["id" => 4])

It does not work.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire