Asked  1 Year ago    Answers:  5   Viewed   12 times

Issue in Laravel 5.3.6 when submitted request in Forgot Password.

Error Details

Call to undefined method IlluminateDatabaseQueryBuilder::notify()

Issue is in below file:

vendorlaravelframeworksrcIlluminateAuthPasswordsPasswordBroker.php

Line 69. Code is below

$user->sendPasswordResetNotification(
    $this->tokens->create($user)
);

Function: sendResetLink

It was working fine in Laravel 5.2 and seems not working in 5.3.6 version. Have you faced this issue?

 Answers

4

You must add IlluminateNotificationsNotifiable trait in User model.

Thursday, April 1, 2021
 
2

You can use method pluck. Method lists is removed in Laravel 5.3. I changed lists('key')->all() to pluck('key')->all() and it's working now.

Thursday, April 1, 2021
 
Pupil
 
5

associate() is a method of the belongsTo relationship, but it looks like from the above you are trying to call it via the hasOne relationship.

I am just guessing as you have not provided your eloquent model class code so can't see how you have set the relationships exactly, but if you have:

class User extends Eloquent {
    public function userinfo()
    {
        return $this->hasOne('Userinfo');
    }
}

class Userinfo extends Eloquent {

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

Then associate needs to be called against Userinfo as this has the belongsTo relationship to which the associate() method is attached.

For example

$user = User::find(4);      
$userinfo = UserInfo::find(1);

$userinfo->user()->associate($user);
$userinfo->save();

Will set the foreign key user_id in the user_info table to the id of the $user object.

Looking at your above code it doesn't appear that this is what you are actually trying to do and that the

$user->userinfo()->update($userinfoArray);

call which you have commented out will in fact do what you seem to be trying to achieve, which is to update the userinfo that is related to the current user if that user already exists.

Hope this helps.

Glen

Thursday, August 12, 2021
3

You are overriding the $premios variable in the foreach. Use it as singular form in the foreach:

@foreach($premios as $premio)
    <span class="tituloPremio">{{$premio->titulo}}</span>
    <span class="dataPremio">{{$premio->data}}</span>
@endforeach

{{ $premios->links() }}
Wednesday, August 18, 2021
 
3

The problem is you are not getting the first instance of your user, and you are just calling the save() on the query itself.

Here is the updated code:

public function getActivate ($code)
{
    $user = User::where('code','=',$code)->where('active','=',0)->first();

    if ($user)
    {
        //Update user to active state
        $user->active = 1;
        $user->code ='';

        if($user->save()) 
        {
            return Redirect::route('home')
                            ->with('global', 'Account Activated ! You can sign in ');
        }
    }

    return Redirect::route('home')
                    ->with('global', 'We could not activate your account. Try again later');
}

Also, you may simplify your query build by replacing where($column, '=', $query) to

$user = User::whereCode($code)->whereActive(0)->first();
Friday, August 27, 2021
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :