1
我不能更新或刪除,尤其是當我在路由文件添加路由::資源(....)MethodNotAllowedHttpException Laravel 5.3
web.php(路由文件)
Route::resource('home/activity','ActivityController');
edit.blade.php
{!!Form::model($activity,['action' => ['[email protected]',$activity->id]])!!}
<div class="form-group">
{!! Form::label('Type :') !!} {!! Form::text('type',null,['class'=>'form-control']) !!}
</div>
<button class="btn btn-primary">Editer</button>
{!!Form::close()!!}
<br>
{!!Form::open(['Methode'=>'Delete','action' => ['[email protected]',$activity->id]])!!}
{!! Form::submit('Delete',['class'=> 'btn btn-danger']) !!}
{!! Form::close() !!}
模型
protected $table ='activities';
protected $fillable =['type']
ActivityControlle ř
public function update($id,Request $request){
$activity = activity::findOrFail($id);
$activity->update($request->all());
return redirect('/home/activity');
}
public function destroy($id){
Activity::destroy($id);
return redirect('/home/activity');
}
**感謝
**感謝**的男人:) – meduprise