jeudi 5 mai 2022

concatenate two values in register

I am modifying a register page, I need to concatenate two values

UI

<div class="col-xs-12 col-md-3 input-group">
    <input name="tomo" type="text" class="form-control" placeholder="Tomo" required autocomplete="off">
    <span style="font-size: 25px; color: #bfc9d4;" class="input-group-addon"> --- </span>
    <input name="folio" type="text" class="form-control" placeholder="Folio" required autocomplete="off">
</div>

The values are tomo and folio

protected function validator(array $data)
{
    return Validator::make($data, [
        'name' => ['required', 'string', 'max:255'],
        'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
        't_matricula' => ['required', 'string', 'max:255'],
        'matricula' => ['required', 'string', 'max:255'],
        'password' => ['required', 'string', 'min:8', 'confirmed'],
    ]);
}

/**
 * Create a new user instance after a valid registration.
 *
 * @param  array  $data
 * @return \App\User
 */
protected function create(array $data)
{
    $user = User::create([
        'name' => $data['name'],
        'email' => $data['email'],
        't_matricula' => $data['t_matricula'],
        'numero' => rand(100, 9200),
        'matricula' => $data['tomo'] . $data['folio'],
        'password' => Hash::make($data['password']),
    ]);

    Mail::to($user->email)->send(new WelcomeMail($user));

    return $user;
}

I must save the tomo and folio values in the matricula field, the problem is that it does not execute the registry, please help.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire