Home>

In Laravel5.5, implement the user name, password and confirmation password on the form and register them in the DB.
It is an image of the input screen → completion screen.

With Model

protected $fillable = ['name', 'password', 'password_check'];
 public static $rules = ['password' =>'required',
                         'password_check' =>'required | same: password'];

Registration partial operation of completion screen

$entity = new Entity ($request->all ());
unset ($entry->password_check);
$entity->save ();
Error message

unset If i do not insert the password_check column in the DB when inserting. ->DB does not want to have a confirmation column.

Tried

If the model item is not "password" and "password_confirmation" is not described in the model in validation, a NotAllowMethod error occurred. (The method was POST and the router was also post, but an error)
Therefore, the description of unset was changed to the same rule, but it seems that it is not an optimal description.

Thank you for teaching.

Supplemental information (FW/tool version etc.)

php: 7.1
apache
laravel: 5.5

  • Answer # 1

      

    If the model item is not "password" and "password_confirmation" is not described in the model in validation, a NotAllowMethod error occurred. (The method was POST and the router was post, but an error)

    This is the normal method.
    The error is probably due to a mistake in the description.

  • Answer # 2

    Do you get rid of password_check for $fillable?

  • Answer # 3

    Model
    $appends
    How about adding?

Related articles