hello i am new to laravel and i am learning as i go i have this problem when i save mi form in the database it go as number i am using a drop down menu mi controller
public function create()
{
return View::make('pets.create')
->with('nerds',Nerd::lists('name'));
}
public function store()
{
// validate
$rules = array(
'name' => 'required',
'type' => 'required',
'awener' => 'required'
);
$validator = Validator::make(Input::all(), $rules);
// process the login
if ($validator->fails()) {
return Redirect::to('pets/create')
->withErrors($validator)
->withInput(Input::except('password'));
} else {
// store
$pet = new Pet;
$pet->name = Input::get('name');
$pet->type = Input::get('type');
$pet->awener = Input::get('awener');
$pet->save();
// redirect
Session::flash('message', 'Successfully created a pet!');
return Redirect::to('pets');
}
}
mi view
<div class="form-group">
{{ Form::label('awener', 'awener') }}
{{ Form::select('awener',$nerds,Input::old('awener'), array('class' => 'form-control')) }}
</div>
dint work i am trying to get the NAME of mi client from the table NERDS and put it in the AWENER in mi PET table when i check the DB i see numbers when it should be a text
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community