Laravel-Backpack / devtools-issues

Bug reports and feature requests for our closed-source DevTools package
4 stars 1 forks source link

[Bug] Column 'password' cannot be null for Users Model #73

Closed altayevrim closed 7 months ago

altayevrim commented 7 months ago

Bug report

What I did

I used Jetstream and didn't change anything on User model. I generated the CRUD and when I want to edit a record I get Integrity constraint violation: 1048 Column 'password' cannot be nullerror.

What I expected to happen

It is a password field, shouldn't it accept null values and act accordingly?

Backpack, Laravel, PHP, DB version

PHP VERSION:

PHP 8.3.3 (cli) (built: Feb 16 2024 00:15:01) (NTS) Copyright (c) The PHP Group Zend Engine v4.3.3, Copyright (c) Zend Technologies with Zend OPcache v8.3.3, Copyright (c), by Zend Technologies

LARAVEL VERSION:

11.1.0.0

BACKPACK PACKAGE VERSIONS:

backpack/basset: 1.3.0 backpack/crud: 6.7.3 backpack/devtools: 3.1.0 backpack/generators: v4.0.4 backpack/pro: 2.1.11 backpack/theme-tabler: 1.2.8

Operating System and Server Setup

I encountered the problem above on my Mac OS machine, and my web server is set up using Herd Pro (MySQL)

karandatwani92 commented 7 months ago

Hey @altayevrim

The password field only sets HTML <input type="password"/>. You'll need to define the logic: "If the sent password is null, remove the password key from the request to skip the password update."

You can see the sample code in Backpack PermissionManager's UserCRUD.

I recommend you use PermissionManager . It would give you more out of the box.

altayevrim commented 7 months ago

Thank you very much! :) I thought that it should work out of the box that's why thought it was a bug 😅