【发布时间】:2015-06-21 21:18:44
【问题描述】:
我已将我的代码精简到最低限度,但我想输入的字段仍然被 Eloquent 设置为空白。我已将所有必要的字段设置为可填写,并且可以更新最初设置为空白的字段。
我在 Eloquent 中使用 Slim 框架。
帖子:
$app->post('/register', function() use($app){
$request = $app->request;
$username = $request->post('username');
//this if was for validation which I removed for testing
if(true){
$app->user->where('username', 'B1401812')->update(['username'=> 'FRANK']);
$app->user->create(array(
'username' => 'bob',
'password' => 'ptest'
));
}else{
$app->render('auth/register.php', [
'errors'=> $v->errors(),
'request' => $request
]);
}
用户模型:
class User extends Eloquent
{
protected $table = 'user_information';
protected $fillable = [
'username',
'password',
'active',
'banner_location',
'profile_picture_location'
];
public function __construct()
{
}
...some other functions
我尝试了建议的解决方案,例如禁用批量分配保护,但没有成功。
【问题讨论】:
-
你能编辑你的问题,添加你的整个路线功能吗?
-
没问题,我已经添加了其余部分。