Level 14
either you have made a typo in active_workspace_id,
the table column is called something else,
or you have not selected this column when loading the user.
Hi everyone,
I enabled the strict mode for all models. I have users and workspaces. A user can only have one active workspace.
The relationship on the user looks like this:
public function activeWorkspace(): BelongsTo
{
return $this->belongsTo(Workspace::class, 'active_workspace_id');
}
Now when trying to set a workspace as active on the user like so: $user->activeWorkspace()->associate($workspace);
...I get this error: The attribute [active_workspace_id] either does not exist or was not retrieved for model [App\Models\User].
I just cannot figure out why this happens. It does not when disabling strict mode.
Does anyone have any idea?
Thanks in advanvce!
Please or to participate in this conversation.