我正嘗試在Laravel上使用BootForm創建窗體。這是PostsController中函數的內容。Laravel無法調用函數
public function update($id,$request)
{
//
$post =findOrFail($id);
$post->update($request->all());
redirect(route('news'));
}
的觀點是下面的代碼:
@extends ('layouts.app')
@section ('content')
<h1>Edit</h1>
{!! BootForm::openHorizontal (['url' => 'user', 'sm' => [2, 5], 'lg' => [2, 5], 'method'=> 'put']) !!}
{!! BootForm::text('Titre', $post->title) !!}
{!! BootForm::text('Slug', $post->slug) !!}
{!! BootForm::textarea('Contenu', $post->content) !!}
<p> <a class="btn btn-primary" href="{{route('news.update', $post) }}">Editer</a></p>
{!! BootForm::close() !!}
@stop
也有是我使用這一個路徑:
Route::resource('news', 'PostsController');
所以,當我按一下按鈕,它在主目錄(localhost:8000)上重定向我。控制器中的功能未被調用。 雖然這篇文章沒有改變。 問題在於更新功能。我想念它嗎? 一些提示或幫助將受到歡迎。
你的問題是什麼? –
只是更新了它 – Sharkos
你表單的action屬性的值是多少?你能在這裏展示你的形式嗎? – HKumar