Reputation: 54
Hello I have a form in laravel opened in model form
{!! Form::model($issue, ['url' => 'calidad/issues/' . $issue->id, 'method' => 'PUT']) !!}
In the form i have some fields stored in a table as $key (name of the field) and $value (value of the field).
I can get the fields values with:
$issue->source()->get()
and this return a collection with the rows.
So my question is, how can i put this values in the form in a simple way.
Upvotes: 0
Views: 308
Reputation: 54
I have a temporary solution with Blade + JQuery + php
In the controller y get the fields and i put them into an array
$input = $issue->source()->get()->lists('value','key');
And I filled the fields with this:
@foreach($input as $key => $value)
$("#{!!$key!!}").val("{!!$value!!}");
@endforeach
I cant think in anything else but this works.
Upvotes: 1