I want to know how to up date a model's relationship using a front end form. I looked at the documents and found:
Alternatively you may set the relationship using the primary key, this is useful when working with HTML forms.
// Assign to author with ID of 3
$post->author = 3;
// Assign comments with IDs of 1, 2 and 3
$post->comments = [1, 2, 3];
$post->save();
This is my code: where I am getting ID as a value but it doesn't seem to affect the relationship field. Help would be great thanks!
$project->client = Input::get('client');
Image of the relationship in the builder.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire