Array to string conversion

Posted 4 weeks ago by danilofer

convert string to array with sync. I'm trying to pass two data from a multiple select to an attribute, looking for a way to synchronize them to convert from string to an array....

     $userRole = new user_role();
     $userRole->provider = $request->provider;
     $userRole->user_id = $request->user_id;
     $userRole->role_id = $request->role_id;
     $userRole->save();
     $role_id=$request->get('role_id');
     $user=user::find($request->user_id);
 $user->roles()->sync($role_id);

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.