I have a problem and I can't resolve it, please help me. So I have my form :
{{ Form::open(array('url'=>'/administration/student/addMarks','method' => 'post')) }}
@foreach($aObjectsInGroupe as $object)
{{ Form::hidden('id_object[]',$object->id) }}
{{ Form::label($object->name) }}
{{ Form::select('note[]', $aMarks, null, array('class'=>'form-control')) }}
<br />
@endforeach
{{ Form::hidden('id',$aOneStudent['id']) }}
{{ Form::submit('Add mark',array('class'=>'btn btn-primary')) }}
{{ Form::close() }}
In my StudentController I have a method for get the mark from student_id and object_id:
public function getMarkByStudentAndObject($nIdStudent, $nIdObject){
$aMark = \Mark::where('student_id', '=', $nIdStudent)
->and('object_id', $nIdObject)
->get()
->toArray();
}
$aMarsks it's a table :
$aMarks = array(
'0'=>'0',
'1'=>'1',
'2'=>'2',
'3'=>'3',
'4'=>'4',
'5'=>'5',
'6'=>'6',
'7'=>'7',
'8'=>'8',
'9'=>'9',
'10'=>'10',
);
It's possible to call the method getMarkByStudentAndObject in :
{{ Form::select('note[]', $aMarks, null, array('class'=>'form-control')) }}
to get the selected value? Help me please. Thx in advance.
maybe you need to do this:
You should also check your Eloquent query, instead of ->and use another ->where