Support the ongoing development of Laravel.io →
Input Forms
Last updated 1 year ago.
0

Hi, I am still struggling quite badly with this. In my edit view, I can output the correct Document and the data for that Document. When I submit though and it hits the update function, the Document is an empty Model.

Any advice appreciated.

Thanks

0

from what i understand the question to be; In your Project model do you have a function that looks something like this document function below?

public function document() { //Document Model whatever that is called. return $this->hasMany('Document', 'documentId', 'id'); }

if you do you can just use it like this $newDocument = $project->document()->create([ array of key values here ]); and you can get all the documents with something like this $projectDocuments = $project->document; or $projectDocuments = $project->document->get();

0

Sign in to participate in this thread!

Eventy

Your banner here too?

nick2price nick2price Joined 20 Jan 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.