In theory that would be $user->data['skills'] = $value, but since the data attribute is protected, you can’t modify the data from outside the User class.
Why do you need to set the data on the user object directly? Couldn’t you return the skills as a separate variable from your controller?
@texnixe See the controller code in the first code block. He wants to set the value to a page collection from a controller.
If Kirby supported User models like you proposed last week, it would be no problem because you could then extend your users with whatever data dynamically. Until then, there’s no really elegant way to do this unfortunately. Using a tags field to define the skills is the best way until then IMO.
collection::set() doesn’t work because a user is no collection.
They are basically equally fast, I’d not expect a huge difference in performance. I think the first one is a bit more robust though, it also seems to make more sense semantically in this case.
Edit: Actually the first one will need to open all content files of the children to read the user field. The second solution would not need to do this. But if you don’t have thousands of portfolios, it doesn’t matter.
Good point! At least 100 users and each user have 10 portfolios, so minumum 1000 portfolios… And skills, educations, certificates etc, second method more performance in this case. really thx @lukasbestle