I pass a Document Object to my view. If I do the following I can see the Object
Now this Document has many DocumentData. If I do the following in my view
I get something like this
array:8 [▼
0 => array:7 [▼
"id" => 62
"documentId" => 13
"key" => "whatData"
"value" => "some data"
"deleted_at" => null
"created_at" => "2016-04-19 12:46:19"
"updated_at" => "2016-04-19 12:46:19"
]
1 => array:7 [▼
"id" => 63
"documentId" => 13
"key" => "whoData"
"value" => ""
"deleted_at" => null
"created_at" => "2016-04-19 12:46:19"
"updated_at" => "2016-04-19 12:46:19"
]
2 => array:7 [▼
"id" => 64
"documentId" => 13
"key" => "startDate"
"value" => "29/04/2016"
"deleted_at" => null
"created_at" => "2016-04-19 12:46:19"
"updated_at" => "2016-04-19 12:46:19"
]
3 => array:7 [▶]
4 => array:7 [▶]
5 => array:7 [▶]
6 => array:7 [▶]
7 => array:7 [▶]
]
So my view now has the data, and I need to get the appropiate data displayed in the appropiate input. At the moment I am trying something like this
{!! Form::textArea('whatData', $projectIdentifiedDoc->documentData->value, array('class' => 'form-control')) !!}
Now obviously that wont work. I somehow need to check if the key matches the input label, and if so, display the value. This code is all wrong, but hopefully it gives you an idea of what I am after
{!! Form::textArea('whatData', if($projectIdentifiedDoc->documentData->key == 'whatData'){$projectIdentifiedDoc->documentData->value}, array('class' => 'form-control')) !!}
Would something like this be possible?
Thanks
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire