Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Bacchus's avatar

Laravel Auth still executing out-of-box insert query

Hello,

Last night I ran installed php artisan ui vue --auth and have started to get everything integrated into my views.

The problem that I'm having is that even though I have modified my migration and successfully added columns to the database and I've modified the RegisterController methods for validator and create with the updated columns, the query that is being executed is still only the base query.

SQLSTATE[HY000]: General error: 1364 Field 'city' doesn't have a default value (SQL: insert into `users` (`name`, `email`, `password`, `updated_at`, `created_at`) values (Jack Hall, [email protected], y$.YSL7DW0iQ9Svb3AcSD/W.Gt5aymDMVQ9S63CRjDnRaSNU/1JosyC, 2020-02-01 20:15:53, 2020-02-01 20:15:53)) 

Here is my RegisterController


    protected function validator(array $data)
    {
        return Validator::make($data, [
            'name' => ['required', 'string', 'max:255'],
            'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
            'password' => ['required', 'string', 'min:8', 'confirmed'],
            'city' => ['required', 'string', 'min:2'],
            'state' => ['required', 'string', 'min:5'],
            'zip' => ['required', 'integer', 'min:5'],
            'mailstop' => ['integer'],
            'dol_employee' => ['required']
        ]);
    }
    protected function create(array $data)
    {
        return User::create([
            'name' => $data['name'],
            'email' => $data['email'],
            'password' => Hash::make($data['password']),
            'city' => $data['city'],
            'state' => $data['state'],
            'zip' => $data['zip'],
            'mailstop' => $data['mailstop'],
            'dol_employee' => $data['dol_employee']
        ]);
    }

Unfortunately, it does not attempt to insert any of the new columns I added.

I've been working with Laravel for a few weeks in earnest, so thanks in advance for any help.

0 likes
2 replies
ahmeddabak's avatar
Level 47

in your User model check the fillable property

Bacchus's avatar

Thank you! I'll remember next time.

Please or to participate in this conversation.