Assigning role in Laravel with registration

Hi Im fairly new to Laravel and what I am trying to achieve is to assign user role to User while registering. I have successfully seeded and created my User table which contains role_id. I have created login and logout but when I try to create register for some reason the role_id that I am passing from URL parameter in my case: {{hostAuth}}/register/1 where ‘1’ should be role_id.

For my RegisterRequest this is how it looks currently:

public function rules(): array
{
    return [
        'name' => 'required|string|max:150',
        'email' => 'required|email|max:150|unique:users',
        'password' => 'required|confirmed',
        'role_id' => 'required'
    ];
}

public function getData(int $role_id): array
{

    $this->merge([
        'role_id' => $role_id,
    ]);

    return $this->validated();
}

Here is my Controller for that part:

 public function __invoke(RegisterRequest $request)
{
    User::create($request->getData(1));
}

public function register(RegisterRequest $request, int $role_id)
{
    User::create($request->getData($role_id));
}

And lastly web route (bcs im using SPA):

Route::post('/register/{role_id}', [RegisterController::class, 'register']);

When I try to run it this is the error I’m getting:

  {
    "message": "The role id field is required.",
    "errors": {
        "role_id": [
            "The role id field is required."
        ]
    }
}

When I dd the role_id I get the correct number but for some reason the role_id is not being added to the part where I validate my data, only the 3 arguments that I passed in my body show, yeah this is my body of the request as well:

{
"name": "test",
"email": "[email protected]",
"password": "password",
"password_confirmation": "password"
}

Like I mentioned Im fairly new to Laravel so if there is a better/cleaner approach than this I’m all ears or if someone can help me figure out what I am doing here wrong. Thanks in advance