Change Jetstream laravel 8 register field from email to cellphone

  jetstream, laravel, mysql, php

i want to change the field that users register from email to their cellphone so here is what i have done so far :
1- i changed the migration to add the cellphone field to the users table and forget password table as below :

   Schema::create('users', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('email');
            $table->string('cellphone')->unique();
            $table->timestamp('email_verified_at')->nullable();
            $table->string('password');
            $table->rememberToken();
            $table->foreignId('current_team_id')->nullable();
            $table->text('profile_photo_path')->nullable();
            $table->timestamps();

2- as far as i saw the config file the fortify.php i changed this column :

   /*
    |--------------------------------------------------------------------------
    | Username / Email
    |--------------------------------------------------------------------------
    |
    | This value defines which model attribute should be considered as your
    | application's "username" field. Typically, this might be the email
    | address of the users but you are free to change this value here.
    |
    | Out of the box, Fortify expects forgot password and reset password
    | requests to have a field named 'email'. If the application uses
    | another name for the field you may define it below as needed.
    |
    */

    'username' => 'email', // i changed from email to cellphone

    'email' => 'email', // i changed from email to cellphone

now i want to know what else i have to do to set the register and login on the cellphone field and customize the register controller to send sms and verify that in the register process . thanks in advance

Source: Laravel

Leave a Reply