0
所以我有一票制,以及我想要做的是,當用戶發表評論對方應該收到一封電子郵件,這裏是我到目前爲止已經完成:Laravel 4.2發送電子郵件給用戶後響應後
在CommentsController:
public function postComment($id) {
$content = trim(Input::get('content'));
if (empty($content)) {
return Redirect::back();
}
if (Auth::user()->isAdmin() || $this->tickets->isTicketBelongsToUser(Auth::user()->id, $id)) {
if (Input::hasFile('attachment')) {
$attachmendId = Uploader::attach(Input::file('attachment'));
}
$comment = $this->comments->getNew(['content' => Input::get('content'), 'user_id' => Auth::user()->id, 'attachment_id' => isset($attachmendId) ? $attachmendId : null, 'ticket_id' => $id]);
//START geting the user id and send email//
$client = $this->users->$id;
$this->userMailer->CommentRespond($id);
//END geting the user id and send email//
$this->comments->save($comment);
}
return Redirect::back()->withMessage('Your comment has been sent');
}
在UserMailer.php:
public function CommentRespond(User $user)
{
$view = 'emails.new-comment';
$subject = 'New Comment has been posted';
$data = [
'name' => $user->name
];
return $this->sendTo($user->email, $subject, $view, $data);
}
錯誤:
ErrorException (E_NOTICE)
Undefined property: Care\Repositories\Eloquent\UsersRepository::$93
我知道它有什麼毛病可變分配,但我無法找到它了,所以請如果你能幫助將是巨大的。
謝謝
感謝您的重播,但仍然得到錯誤「未定義的屬性:護理\庫\雄辯\ UsersRepository: :$ id爲「 –
:) – Kzy
遠高於更新,還是男人我得到一個錯誤‘未定義的屬性:護理\庫\雄辯\ UsersRepository :: $ id爲’ –