Я создал
php artisan make:mail ContactFormFilledOut
, который прекрасно работает. Но единственная проблема, с которой я столкнулся, заключается в том, что я не могу получить доступ к почте пользователей, чтобы вставить ее в
->from('users-mail')
Я пытаюсь получить почту пользователей, выполнив это $this->input->mail
, но получаюошибка Trying to get property 'mail' of non-object
, поэтому я попытался также сделать $this->input['mail']
. Это тоже не помогло.
public function build()
{
return $this->view('mail.kontaktform')
->from($this->input->mail) // HERE IS THE ISSUE
->subject('Test subject');
}
Здесь у нас есть весь код
class ContactFormFilledOut extends Mailable
{
use Queueable, SerializesModels;
public $input;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct($input)
{
$this->input = $input;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->view('mail.kontaktform')
->from($this->input->mail) // HERE IS THE ISSUE
->subject('Test subject');
}
}