Laravel 5 – retrieving old input

I am passing one of my views a document object. Within my view, if I do


{{ $document }}

I can see the document


{
"id":2,
"projectId":1,
"name":"DocumentA"
}

This document has data, the form data that was submitted. In my view, if I do


{{ $document->documentData }}

I can see


[
{
"id":1,
"documentId":2,
"key":"_token",
"value":"WJGplDnTuMpDK7X3AD9dgIliX2SliBSz2sjxivVy"
},
{
"id":2,
"documentId":2,
"key":"teamLeader",
"value":"Jason Sullivan"
},
{
"id":3,
"documentId":2,
"key":"clientName",
"value":"Google"
},
{
"id":4,
"documentId":2,
"key":"projectName",
"value":"Analytics"
}
]

So all of this data is related to DocumentA, linked by documentId.

So my view now has this document object, and I can access the data for the document. The key is the input field, and the value was the inputted data. An input in my view generally looks like the following


{!! Form::label('teamLeader', 'Team Leader:', array('class' => 'col-sm-5 control-label green')) !!}
{!! Form::textArea('teamLeader', old('$document->documentData'), array('class' => 'form-control')) !!}

As you can see, I am trying to get the old data displayed in my edit form. This input is for teamLeader, so it should display the value where teamLeader is the key. So in the data I outputted above, you can see that this field should display Jason Sullivan.

How would I go about getting it to do this?

Thanks

from Newest questions tagged laravel-5 – Stack Overflow http://ift.tt/1SC7qW7
via IFTTT

Related Posts

Codeigniter : Parse error: syntax error, unexpected ‘const’ (T_CONST), expecting variable (T_VARIABLE) in Laravel project

I’m getting following error: **Parse error: syntax error, unexpected ‘const’ (T_CONST), expecting variable (T_VARIABLE)** Note : It’s working in local but facing issue in production server. private…

Firebase receive notification while tab is active or on focus

What i want is to be able to perform an action when a user receives a notification while the browser is open and tab is active or…

Laravel’s alias loader does not find class

We have a legacy project that we cannot update and we need to make some changes in symfony’s Response.php in vendor. We have solved this by copying…

Laravel 5 – generic document management

I have a system where you can create different types of unique documents. For instance, one document is called Project Identified and this expects certain inputs. Originally,…

Laravel Nova limit the results in indexQuery

I ran intro a situation where I need to limit the results of a resource to only 3 results. To be more specific, based on the logged…

Auditoria en laravel 5.8 [closed]

Cómo puedo automatizar el registro de actividades de un usuario en laravel? Si un usuario ingresa a un app de laravel, debo guardar toda su actividas, a…

Leave a Reply

Your email address will not be published.