Im getting Getting MethodNotAllowedHttpException in RouteCollection.php line 219:Store, create, edit are all working but when trying to update I get the error above.
{!! Form::model($enrollment['method'=>'POST','route'=>['/enrollment',$enrollment->id],'class'=>'form-horizontal']) !!}
<div class="form-group">
<label for="subject_code" class="col-md-3 control-label">Subject Code</label>
<div class="col-md-8">
<select class="form-control" name="_method" value="PUT" id="subject_code">
<option value="{{ $enrollment->subject_code }}">{{ $enrollment->subject_code }}</option>
@foreach($subjects as $subject)
<option value="{{ $subject->subject_code }}">{{ $subject->subject_code}}</option>
@endforeach
</select>
</div>
</div>
<div class="form-group">
<label for="subject_description" class="col-md-3 control-label">Subject description</label>
<div class="col-md-8">
<select class="form-control" name="subject_description" id="subject_description">
<option value="{{ $enrollment->subject_description }}">{{ $enrollment->subject_description }}</option>
@foreach($subjects as $subject)
<option value="{{ $subject->subject_description }}">{{ $subject->subject_description}}</option>
@endforeach
</select>
</div>
</div>
<div class="form-group">
<label for="subject_code" class="col-md-3 control-label">Subject Code</label>
<div class="col-md-8">
<select class="form-control" name="subject_code" id="subject_code">
<option value="{{ $enrollment->section }}">{{ $enrollment->section}}</option>
@foreach($sections as $section)
<option value="{{ $section }}">{{ $section }}</option>
@endforeach
</select>
</div>
</div>
<div class="form-group">
<label for="subject_code" class="col-md-3 control-label">Subject Code</label>
<div class="col-md-8">
<select class="form-control" name="subject_code" id="subject_code">
<option value="{{ $enrollment->schedule }}">{{ $enrollment->schedule }}</option>
@foreach($subjects as $subject)
<option value="{{ $subject->schedule }}">{{ $subject->schedule}}</option>
@endforeach
</select>
</div>
</div>
<div class="form-group">
<label for="subject_code" class="col-md-3 control-label">Subject Code</label>
<div class="col-md-8">
<select class="form-control" name="subject_code" id="subject_code">
<option value="{{ $enrollment->no_of_units }}">{{ $enrollment->no_of_units }}</option>
@foreach($subjects as $subject)
<option value="{{ $subject->no_of_units }}">{{ $subject->no_of_units}}</option>
@endforeach
</select>
</div>
</div>
<div class="form-group">
<div class="col-md-7 col-md-offset-3">
<button type="submit" class="btn btn-success">
<i class="fa fa-save"></i>
Save Changes
</button>
<button type="submit" class="btn btn-danger">
<i class="fa fa-times-circle"></i>
Delete
</button>
</div>
</div>
{!! Form::close() !!}
Here's my EnrollmentController:
public function update(EnrollmentRequest $request, $id)
{
$enrollment = Enrollment::findOrFail($id);
$enrollment->update($request->all());
return redirect('/enrollment');
}
routes.php
// Authentication routes...
Route::get('auth/login', 'Auth\AuthController@getLogin');
Route::post('auth/login', 'Auth\AuthController@postLogin');
Route::get('auth/logout', 'Auth\AuthController@getLogout');
// Registration routes...
Route::get('auth/register', 'Auth\AuthController@getRegister');
Route::post('auth/register', 'Auth\AuthController@postRegister');
Route::resource('enrollment','EnrollmentController');
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1nBMfIj
via IFTTT
Aucun commentaire:
Enregistrer un commentaire