我得到这个错误:UrlGenerationException:缺少必需的参数[路线:topics.update] [URI:主题/ {}话题]
Missing required parameters for [Route: topics.update] [URI: topics/{topic}]. (View: C:\xampp\htdocs\phpboards\resources\views\topics\edit.blade.php)
这是链接,将采取用户编辑:
<a href="/boards/topics/edit/{{$topic->id}}" class="btn btn-default">Edit</a>
这是编辑控制器:
$topic = Topic::find($id);
return view('topics.edit')->with('topic', $topic);
这是路线:
Route::get('/boards/topics/edit/{id}', '[email protected]');
这是编辑的形式:
<div class="container">
{!! Form::open(['action' => '[email protected]', 'method' => 'POST']) !!}
<div class="form-group">
{{ Form::label('title', 'Title') }}
{{ Form::text('title', $topic->topic_title, ['class' => 'form-control', 'placeholder' => 'Title of the Post']) }}
</div>
<div class="form-group">
{{ Form::label('desc', 'Desc') }}
{{ Form::textarea('desc', $topic->topic_body, ['class' => 'form-control', 'placeholder' => 'Description of the Post']) }}
</div>
{{ Form::submit('Submit', ['class' => 'btn btn-default']) }}
{!! Form::close() !!}
</div>
我做了什么错在这里?
@ParantapParashar但是对于什么?并为哪个控制器? –
你的代码有太多的错误。 –
我认为你必须把你的更新方法和路线放在这里。 –