samedi 25 mars 2017

Laravel Call to a member function send() on a non-object

I am trying to send a mail using my laravel controller, a very simple mail which is sent in my localhost with no problems but once in server I get this error :

20170325T153701: /public/index.php 
PHP Fatal error:  Call to a member function send() on a non-object in /public/index.php on line 56 
PHP Fatal error:  Call to a member function send() on a non-object in /vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php on line 107 

The browser only shows a 500 error, the error is only seen in my error log. Here is the code used to send the mail

    use Illuminate\Support\Facades\Mail; // just to say I'm calling it
    $v_code = str_random(30);
    $mail_content = array('code' => $v_code);


    $user = User::create([
        'name' => $data['name'],
        'email' => $data['email'],
        'password' => bcrypt($data['pass']),
    ]);

    if ($user) {
        Mail::send('User::mail.verifyMail', $mail_content, function ($message) use ($data) {
            $message->to($data['email'], $data['name'])
                ->subject('Verify your email address');
        });



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2niSJfZ
via IFTTT

Aucun commentaire:

Enregistrer un commentaire