Support the ongoing development of Laravel.io →
posted 1 year ago
Last updated by @tvbeek 1 year ago.

amite liked this thread

1
moderator

Hello @titia-sudo

I think you need to change $user->roles()->attach($request->role_id); to $user->roles()->attach($request->role); because in your request you call it role and not role_id.

ps. I have updated your post to get clear codeblocks.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

OFT titia-sudo Joined 18 Sep 2023

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.