mercredi 4 octobre 2017

I want to send email using improved laravel email, I want to send some variable along with view

This is my mail class

class createassets extends Mailable
{
    use Queueable, SerializesModels;

/**
 * Create a new message instance.
 *
 * @return void
 */
public function __construct()
{
    //
}

/**
 * Build the message.
 *
 * @return $this
 */
public function build()
{
    return $this->view('email.createassets');
}
}

this is function where i am calling this mail class to send email but i want to send some variable on view. I am using the below method but getting undefined variable error

$responsibleperson=employees::where('id',Input::get('rid'))->first();
                Mail::to($responsibleperson->email)->send(new createassets)->with([
                    'username' => $responsibleperson->name,
                    'inventoryno' => $lastid,
                     'creator'=>Auth::user()->name
                ]);;

I want to show username creator and inventoryno on email view



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire