Browse Source

Set fillable array.

Taylor Otwell 9 years ago
parent
commit
8ce0d263c1
2 changed files with 8 additions and 1 deletions
  1. 1 1
      app/Services/Registrar.php
  2. 7 0
      app/User.php

+ 1 - 1
app/Services/Registrar.php

@@ -29,7 +29,7 @@ class Registrar implements RegistrarContract {
 	 */
 	public function create(array $data)
 	{
-		return User::forceCreate([
+		return User::create([
 			'name' => $data['name'],
 			'email' => $data['email'],
 			'password' => bcrypt($data['password']),

+ 7 - 0
app/User.php

@@ -17,6 +17,13 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
 	 */
 	protected $table = 'users';
 
+	/**
+	 * The attributes that are mass assignable.
+	 *
+	 * @var array
+	 */
+	protected $fillable = ['name', 'email', 'password'];
+
 	/**
 	 * The attributes excluded from the model's JSON form.
 	 *