Monday, May 22, 2017

Trying to get property of non-object on running laravel queue work command

I am getting a really weird issue with my laravel 5.1 app. When I run the command

$ php artisan queue:work

I get the error below:

  [ErrorException]                                                             
  Trying to get property of non-object (View: /var/www/html/divostar/resource  
  s/views/emails/password_update.blade.php)                                    



  [ErrorException]                      
  Trying to get property of non-object  

Below is how I send the email

 $user = $this->user->get_user_by_id($id);
 Mail::queue('emails.password_update', ['user' => $user, 'password' => $password], function($message) use ($user){
            $message->to($user->email, $user->name)->subject('Account Password Updated');
            $message->replyTo(config('mail.replyTo.address'), config('mail.replyTo.name'));
            $message->priority(1);
        });

This is weird because this same code is working well on another server. I have done the following on this server but with no success:

$ composer dump-autoload
$ php artisan clear-compiled
$ php artisan cache:clear
$ sudo apachectl restart

What could be the problem?



via Fokwa Best

Advertisement