Laravel Reset Password Error, Attribute Email is not in user entity

Viewed 58

so I'm having an error in Laravel reset password because I want to access email, not from user entity. I have deleted the email attribute in the user entity. So here are my models

User Models Has One To One Relationship with the team:

public function team()
    {
        return $this->hasOne(Team::class, 'user_id');
    }

Team Models Has Many To Many Relationship with Participant:

public function participants()
    {
        return $this->hasMany(Participant::class, 'team_id');
    }

public function user()
    {
        return $this->belongsTo(User::class, 'user_id');
    }

Participant Model:

public function team()
    {
        return $this->belongsTo(Team::class, 'team_id');
    }

Here are the user migration, i already delete the email attribute:

Schema::create('users', function (Blueprint $table) {
            $table->id();
            $table->string('role');
            $table->string('username')->unique();
            $table->string('password');
            $table->rememberToken();
            $table->timestamps();
        });

Here are the Team Migration

Schema::create('teams', function (Blueprint $table) {
            $table->id();

            $table->string('name', 50);

            $table->string('status', 25);

            $table->timestamp('registration_date')->useCurrent();
            $table->string('invoice', 200)->nullable();
            $table->bigInteger('nominal')->default('0');
            
            $table->foreignId('competition_id');
            $table->foreign('competition_id')->references('id')->on('competitions')->onUpdate('cascade')->onDelete('cascade');
            
            $table->foreignId('teacher_id');
            $table->foreign('teacher_id')->references('id')->on('teachers')->onUpdate('cascade')->onDelete('cascade');

            $table->foreignId('user_id');
            $table->foreign('user_id')->references('id')->on('users')->onUpdate('cascade')->onDelete('cascade');

            $table->char('login_token')->default('');
            
            $table->timestamps();
        });

And here is the Participant Migration, I want to send the forgot password's email on Participant email which has role == "leader"

 Schema::create('participants', function (Blueprint $table) {
        $table->id();
        $table->timestamps();

        $table->string('nama', 50);
        $table->string('nis', 20)->nullable();
        $table->string('student_card', 100);
        $table->string('class', 10);

        $table->string('phone_number', 20);
        $table->string('email', 100);
        $table->string('address', 100)->nullable();

        $table->string('role');

        $table->foreignId('team_id');
        $table->foreign('team_id')->references('id')->on('teams')->onUpdate('cascade')->onDelete('cascade');

    });

Please help me to solve this, thanks

0 Answers
Related