Edit a form in laravel

0

Somebody can help me, I do not load the data in the view of editing in laravel.

I'm making a query so you know which record to edit ..

I have seen that this is often done:

 $asignacion=C_materia::find($id);  
 $id  = $asignacion->idc_materia;

and I try to do it with this:

  $idkalificacion = DB::table('k_calificaciones')
        ->join('k_alumnos', 'k_calificaciones.idk_alumno', '=', 'k_alumnos.idk_alumno')
        ->join('c_materias', 'k_calificaciones.idc_materia', '=', 'c_materias.idc_materia')
        ->select('k_calificaciones.*','k_calificaciones.id','k_calificaciones.primera_cal','k_calificaciones.segunda_cal','k_calificaciones.ps_cal','k_calificaciones.tercera_cal','k_calificaciones.prom_cal','k_calificaciones.fecha_curso','k_calificaciones.tipo_de_aprob')
        ->where('c_materias.idc_materia', '=', $id)->where('k_alumnos.idk_alumno','=', $id2)->get();

The variables $ id and $ id2 I receive them and with those I do the comparison

It does not mark me wrong, but it does not show me the data.

in the view I do this:

   <td>
                        <div class="form-group{{ $errors->has('primera_cal') ? ' has-error' : '' }}">
                            <div class="col-xs-12">

                            <input id="primera_cal" type="input" class="form-control" name="primera_cal" value="{{$idkalificacion->primera_cal}}">

                                @if ($errors->has('primera_cal'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('primera_cal') }}</strong>
                                    </span>
                                @endif
                            </div> 
                            <br>
                        </div>

                    </td>

I pull them in a table the data .. I hope you can help me.

    
asked by Estefania 10.11.2017 в 01:47
source

1 answer

0

Greetings, I think I have the solution, by doing ->get() you are getting an array as a result and you use $idkalificacion as object in: $idkalificacion->primera_cal .

What you should do is call first() in get() account and it would work. Or call your parameter in this way: $idkalificacion[0]->primera_cal so you do not have problems.

    
answered by 13.11.2017 / 23:09
source