this is my form:
{!! Form::model($countries, ['route' => ['countries.update', $countries->id], 'method' => "PUT"]) !!}
{{ Form::label('code', 'Country Code:') }}
{{ Form::text('code', null, ['class' => 'form-control']) }}
{{ Form::label('name', 'Country Name:') }}
{{ Form::text('name', null, ['class' => 'form-control']) }}
{{ Form::submit('Save', ['class' => 'mt-20 btn btn-success btn-sm']) }}
{!! Form::close() !!}
and this is my update function:
$countries = Country::find($id);
$this->validate($request, array(
'code' => 'required|min:2|max:4',
'name' => 'required|max:255'
));
$country = Country::where('id',$id)->first();
$country->code = Input::get('code');
$country->name = Input::get('name');
$country->save();
Session::flash('success', 'The Country info was successfully updated.');
return redirect()->route('locations.index', $country->id);
what is the issue in my form that I'm getting Undefined variable: countries
error from my blade?