angular-laravel创建用户提供查询异常

时间:2015-09-30 06:22:23

标签: php angularjs laravel

我正在尝试在基本的laravel-angularjs应用中创建新用户。我收到500服务器错误,并进一步查看它有一个查询异常。我正在传递哈希密码的文本值。是因为这个错误?

角度控制器:

user.saveUsers({
          "first_name":um.firstName,
          "last_name":um.lastName,
          "admin":um.admin,
          "email":um.email,
          "password":um.password
        }).then(function(success) {

          console.log(success);
        }, function(error) {
          console.log(error);
        }); 

laravel控制器:

public function store(Request $request)
    {
        //
        $data = Request::all();

        $users = new User();

        $users->fill($data);

        $users->save();
    }

users.php:

 protected $fillable = ['first_name','last_name','admin', 'email', 'password'];
 protected $hidden = ['password', 'remember_token', 'created_at', 'updated_at'];

表格结构:

CREATE TABLE "users" ("id" integer not null primary key autoincrement, "first_name" varchar not null, "last_name" varchar not null, "admin" tinyint not null, "email" varchar not null, "password" varchar not null, "remember_token" varchar null, "created_at" datetime not null, "updated_at" datetime not null)

0 个答案:

没有答案