My Friend my problem with URL $category in Laravel update post my view update post:
{{--insert category--}}
<div class="col-sm-6">
{{Form::model($category,['method'=>'patch','url'=>['category/update',$category->id]])}}
<div class="form-group">
<div class="form-group">
{{form::text('category','',['class'=>'form-control text-right','placeholder'=>'submit'])}}
</div>
{{form::submit('submit',['class'=>'btn btn-primary'])}}
</div>
{{Form::close()}}
</div>
my route :
Route::group(['middleware' => 'web'], function () {
Route::auth();
Route::get('update/{id}', 'categoryController@update');
});
Route::group(['middleware' => 'web'], function () {
Route::auth();
Route::post('update/{id}', 'categoryController@patchUpdate');
});
my controller:
public function update($id){
Category::find($id);
return view('admin.updateCategory',compact('id'));
}
public function patchUpdate($id,request $request){
$category = Category::find($id);
return redirect('category');
}
my error is:
Undefined variable: category (View: C:\wamp\www\pc\resources\views\admin\updateCategory.blade.php)
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/24z0aQg
via IFTTT
Aucun commentaire:
Enregistrer un commentaire