【发布时间】:2018-08-15 07:28:48
【问题描述】:
我开始学习 Laravel。我在使用theme001::create($request->all()); 时遇到csrf_field() 和_token 错误的问题,我收到这样的消息:
MassAssignmentException _token
这是我的代码:
控制器:MainController.php
public function post_social_media(Request $request){
theme001::create($request->all());
return 'Success!';
}
型号:theme001.php
protected $table = 'social_media';
protected $filltable = ['facebook'];
路由:web.php
Route::get('/social-media', 'MainController@get_social_media');
Route::post('/social-media', 'MainController@post_social_media');
【问题讨论】:
-
$filltable应该是$fillable -
我真是瞎了眼!求救老哥!