This is the code:
activationservice.php
Mailer = $mailer; $this->activationrepo = $activationRepo; The Public Function Sendactivationmail ($user) {if ($user->activated | |! $this->shoul Dsend ($user)) {return; } $token = $this->activationrepo->createactivation ($user); $link = route (' User.activate ', $token); $message = sprintf (' Activate account%s ', $link, $link); $this->mailer->raw ($message, function (message $m) use ($user) {$m->to ($user->email)->subje CT (' Activation mail '); }); The Public Function Activateuser ($token) {$activation = $this->activationrepo->getactiva Tionbytoken ($token); if ($activation = = = null) {return null; } $user = User::find ($activation->user_id); The following line is 53 rows. $user->activated = true; $user->save (); $this->activationrepo->deleteactivation ($token); return $user; } Private Function Shouldsend ($user) {$activation = $this->activationrepo->getactivati On ($user); return $activation = = = NULL | | Strtotime ($activation->created_at) + * $this->resendafter < time (); } }
Error message:
ErrorException in ActivationService.php line 53: Creating default object from empty value
The position of the 53 line is commented in the code, and the code is$user->activated = true;
Problem:
How does the above code resolve this error?