Skip to content
This repository was archived by the owner on Feb 18, 2022. It is now read-only.

Existing users are not initialized on migration #19

@mralston

Description

@mralston

I have an existing codebase with many users already in the database. When I retrieve one of these existing users, their settings are not initialised. This results in the following error when I attempt to set the value of a setting on one of these users:

use App\Models\User;
$user = User::find(1);
$user->settings->set('dark_mode', true);

// RuntimeException with message 'The setting [dark_mode] doesn't exist.'

I have created a PR which resolves this by hooking into the retrieved Eloquent event within the HasConfig trait.

PR: Initialise when loading historic user records

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions