sendUsers( array( $user ), $title, $message, $files); } public function sendUser($user, $title, $message, $files = array()) { $this->sendUsers( array( $user ), $title, $message, $files); } public function sendUsers(array $users, $title, $message, $files = array()) { foreach($users as $user) { $this->sendEmail($user->userid, $user->name, $title, $message, $files); } } public function sendEmail($email, $name, $title, $messageText, $files = array()) { Mail::raw( $messageText, function ($message) use ($email, $name, $title, $messageText, $files) { $message->subject($title); $message->setBody($messageText, 'text/html'); $message->from('mailer-daemon@dowajwo.com', '도와줘'); $message->to($email, $name); foreach($files as $file) { $message->attach($file['path'], ['as' => $file['name']]); } }); } } ?>