I am new in laravel. I am working with laravel 5.1
I am stuck into routing of laravel. I used Form/Html for insert/update. But i 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 rout 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 i gives me
MethodNotAllowedHttpException in RouteCollection.php
I don't know what's going on. can anyone helps me.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire