mardi 1 novembre 2016

Non-static method Bogardo\Mailgun\Mailgun::send() should not be called statically, assuming $this from incompatible context

Hi I am using bogard/mailgun library to send email I have followed steps from http://ift.tt/1lisuAu

following code I have called in controller

Mailgun::send('emails.welcome', $data, function($message)
{
    $message->to('foo@example.com', 'John Smith')->subject('Welcome!');
});

Error showing from above code Non-static method Bogardo\Mailgun\Mailgun::send() should not be called statically, assuming $this from incompatible context

Here send function's code

namespace Bogardo\Mailgun;

use Bogardo\Mailgun\Mailgun\Lists;
use Bogardo\Mailgun\Mailgun\MailgunApi;
use Bogardo\Mailgun\Mailgun\Message;
use Closure;
use Illuminate\View\Factory;

class Mailgun extends MailgunApi
{

    /**
     * Send a new message.
     *
     * @param string|array   $view
     * @param array          $data
     * @param Closure|string $callback
     * @param bool           $mustInit
     *
     * @return object Mailgun response containing http_response_body and http_response_code
     */
    public function send($view, array $data, $callback, $mustInit = true)
    {
        if ($mustInit) {
            $this->_init();
        }

        $this->callMessageBuilder($callback, $this->message);

        $this->getMessage($view, $data);

        return $this->mailgun(true, config('mailgun.api_key'))->sendMessage(config('mailgun.domain'), $this->getMessageData(), $this->getAttachmentData());
    }
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire