コード例 #1
0
 public function postReport($id)
 {
     $args = Input::all();
     $report_user = $this->userRepository->find($id);
     $user = Contact::first();
     // admin
     $args['email'] = Auth::user()->email;
     $args['name'] = Auth::user()->username;
     $args['report_user_email'] = $report_user->email;
     $args['report_user_username'] = $report_user->username;
     $rules = array('subject' => 'required', 'body' => 'required|min:5');
     $validate = Validator::make($args, $rules);
     if ($validate->passes()) {
         if ($this->mailer->sendMail($user, $args)) {
             return parent::redirectToAdmin()->with('success', 'Mail Sent');
         }
         return parent::redirectToUser()->with('error', 'Error Sending Mail');
     }
     return Redirect::back()->withInput()->with('error', $validate->errors()->all());
 }