I have a Controller to add an "Annotation" to a student, which receives "student_id", "id_asignatura" and "id_profesor", but I have problems in the view, since it only shows me the "id" in the fields and even though I change parameters it does not work for me.
This is the Form:
{{ Form::open(array('url' => 'agregar/anotacion','method'=>'POST')) }}
<div class="row">
<div class="col-xs-6 col-sm-6 col-md-6">
<div class="form-group">
{!! Form::label('id_alumno', 'Alumno') !!}
{!! Form::text('id_alumno', $alumno->id, array('class' => 'form-control')) !!}
</div>
<div class="form-group">
{!! Form::label('id_asignatura', 'Asignatura') !!}
{!! Form::text('id_asignatura', $asignatura->id, array('class' => 'form-control')) !!}
</div>
<div class="form-group">
{!! Form::label('tipo','Tipo')!!}
{!! Form::select('tipo', ['' => 'Seleccionar...','Positiva' => 'Positiva', 'Negativa' => 'Negativa'], null, ['class' => 'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label('descripcion','Descripcion')!!}
{!! Form::textarea('descripcion', null,['class' => 'form-control textarea-descripcion']) !!}
</div>
<button type="submit" class="btn btn-primary">Registrar</button>
<a class="btn btn-danger" href="{{URL('showalumnosasignatura', $asignatura->id)}}">Cancelar</a>
</div>
</div>
{{ Form::close() }}
When I make changes to the variable, for example $ student- > name and $ asignatura_nombre, it shows me the name of the student and subject, but when registering the annotation it does not receive the "ids" and the error data. Does anyone know how I could solve this? I want you to show me the Rut and the Code of the subject in the field and in a "disabled" way. When I put disabled, I do not catch the "ids" of both.
This is my Controller:
public function agregarAnotacion($id, $idasi)
{
$alumno = Alumno::find($id);
$asignatura = Asignatura::find($idasi);
return view('agregar/anotacion')->with('alumno',$alumno)->with('asignatura',$asignatura);
}
public function guardarAnotacion(Request $request)
{
$conducta = new Conducta($request->all());
$conducta->id_profesor = auth('profesor')->user()->id;
$conducta->fecha = Carbon::now();
$conducta->save();
flash('Anotacion agregada exitosamente!','success');
return redirect()->route('conductas.index');
}
And my routes:
Route::get('agregar/anotacion/{id}/{idasi}','AgregarAnotacionController@agregarAnotacion');
Route::post('agregar/anotacion','AgregarAnotacionController@guardarAnotacion');