當我填寫提交表單時它給此按摩BadMethodCallException在Macroable.php第74行: 方法存儲不存在。如何使用Store()方法將圖像存儲在數據庫中的laravel 5.2
ArticleController
public function store(Request $request)
{
$file = $request->file('attach');
$filename = $file->store('local');
$article = new Article;
$article->title = $request->title;
$article->body = $request->body;
$article->attachment = $filename;
$article->save();
Session::flash('msg','Your data is saved now');
return back();
}
addarticle.blade.php
{{Session::get('msg')}}
<form class="container col-lg-6" action="article" method="post" enctype ="multipart/form-data">
{{csrf_field()}}
<div class="form-group"></div>
Title <input type="text" class="form-control" name="title">
Body <textarea name="body" id="" class="form-control" cols="30" rows="10">
</textarea>
<input type="file" name="attach">
<input type="submit">
</div>
路線
Route::get('/', function() {
return view('welcome');
});
Route::get('article','[email protected]');
Route::post('article','[email protected]');
Route::get('allarticle','[email protected]');
我改變,但仍同樣的錯誤 –
順便說一句,按照「引導規範」的HTML是無效的。 –