I am working with laravel 5.1
I am using the routes of laravel.
I used Form/Html for insert/update, but stuck in routing of update record.
Here is route for redirect to edit page in routes.php
Route::get('/company/edit/{id}','CompanyMasterController@edit');
In my CompanyMasterController.php
public function edit($id)
{
$company = CompanyMasters::find($id);
return view('companymaster.edit', compact('company'));
}
My action in edit.blade.php
{!! Form::model($company,['method' => 'PATCH','action'=>['CompanyMasterController@update','id'=>$company->id]]) !!}
and route for this action in routes.php
Route::put('/company/update/{id}','CompanyMasterController@update');
My controller action for update.
public function update($id)
{
$bookUpdate=Request::all();
$book= CompanyMasters::find($id);
$book->update($bookUpdate);
return redirect('/company/index');
}
Now when I click on submit button it gives me:
MethodNotAllowedHttpException in RouteCollection.php
What am I doing wrong?