2 years ago

Mail - Object of class App\\Mail\\RequestAccepted could not be converted to int

Posted 2 years ago by russellwwest

HI, I have a Mail class that is sent when a user accepts a quote. However, when I call the mail I get the following error "Object of class App\Mail\RequestAccepted could not be converted to int"

This is how I am sending the mail:

Mail::to('[email protected]')->send(new RequestAccepted(Auth::user(),$dev));

This is the Mail class for RequestAccepted


namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
use App\User;
use App\Organisation;

class RequestAccepted extends Mailable
    use Queueable, SerializesModels;

    protected $name;
    protected $org;
    protected $req;
     * Create a new message instance.
     * @return void
    public function __construct(User $user, $dev)
        $this->name = $user->name;
        $this->org = Organisation::find($user->organisation_id);
        $this->req = $dev->title;

     * Build the message.
     * @return $this
    public function build()
        return $this->markdown('emails.requests.accepted')
                'name' => $this->name,
                'org' => $this->org->name,
                'dev' => $this->req

And this is the Markdown email:

## Development Request Quote Accepted

Dear Russell,

A quote for development request {{$dev}} has been accepted by {{$name}}


Any ideas what is causing this error message?

Thanks in advance

Please sign in or create an account to participate in this conversation.