I have created a small applications and I am creating an edit form. I have 2 tables one "cars" and the other named "classes". Table clrs has a field named class which has all id of table classes. I have join query which gets data from 2 tables and displays at the form. The problem is that I want to create a dropdown list at field "class" which gets all classes from table classes and displays with a dropdown, but also I want to set the default value the class which is the id in table "cars".
public function edit($id) {
$values = DB::table('cars')
->join('classes', 'cars.class', '=', 'classes.id')
->select('cars.*', 'classes.class')
->where ('cars.id','=',$id)
->get();
return View::make('pages.edit')->with('values', $values);
}
edit.blade.php
<div class="form-group">
{{ Form::label('class', 'Class', array('class'=>'control-label col-lg-4')) }}
<div class="col-lg-8">
{{ Form::text('class', $v->class, array('class' => 'form-control')) }}
</div>
</div>
I want to create an other query at controller that gets all classes existing in table classes and to put them at the form as a dropdown list. I don't know how to pass 2 arrays at view. I really need some help
View::make(...)->with('values1',$values1)->with('values2',$values2)?