0
我已经将我的代码剥离到最低限度,并且仍然想要输入的字段由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
我试着提出解决方案,如禁用,没有运气的质量分配的保护。
你可以编辑你的问题,添加你的整个路线功能? –
当然,我已经加入了其余的。 – Josh