0
私はチケットシステムを持っています。私がしたいことは、ユーザーが電子メールを受け取るべきコメントを投稿するときです。 CommentsControllerでLaravel 4.2投稿応答後にユーザーに電子メールを送信
:UserMailer.phpで
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');
}
:
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
"未定義のプロパティ:Care \ Repositories \ Eloquent \ UsersRepository :: $ id " –