function createFeedback(FeedbackRequest $request)
 {
     // Double check to make sure the current user is authorized to do this...
     $this->authorize('create-feedback');
     $input = $request->all();
     // Check application ID
     $application = Application::find($input['application_id']);
     // Check regarding ID / type, Note, nothing to be done for 'general' feedback
     if ($input['regarding_type'] == 'question') {
         $regarding = Question::find($input['regarding_id']);
     } elseif ($input['regarding_type'] == 'document') {
         // todo
     }
     // Create new feedback
     $feedback = new Feedback();
     $feedback->application_id = $application->id;
     $feedback->regarding_type = $input['regarding_type'];
     if (isset($regarding) && $regarding->exists) {
         $feedback->regarding_id = $regarding->id;
     }
     // Set the current judge ID for a record of who requested this feedback
     $feedback->user_id = Auth::user()->id;
     $feedback->save();
     $feedback->update($input);
     // Notify applicant of new feedback requested
     event(new FeedbackChanged($feedback, ['status' => 'created']));
     $request->session()->flash('success', 'Your feedback has been requested.');
     return redirect('/applications/' . $application->id . '/review');
 }
 public function store(FeedbackRequest $request)
 {
     return redirect()->back()->withErrors(['done' => true]);
     $data = $request->input();
     $url = env('WORKSECTION_URL') . '/api/admin/';
     $action = 'post_task';
     $page = '/project/' . env('WORKSECTION_PROJECT_ID') . '/';
     $data = ['email_user_from' => '*****@*****.**', 'email_user_to' => '*****@*****.**', 'title' => trans('feedback.type.' . $data['type']) . (!empty($data['id']) ? ' ' . $data['id'] : ''), 'text' => sprintf('%s<br>%s<br><br><strong>URL</strong>: <a href="%s">%s</a><br><strong>Контактна особа</strong>: %s <%s> %s', $data['subject'], $data['message'], $request->server('HTTP_REFERER'), $request->server('HTTP_REFERER'), $data['name'], $data['email'], $data['phone']), 'action' => $action, 'page' => $page, 'datestart' => date('d.m.Y'), 'hash' => md5($page . $action . env('WORKSECTION_KEY'))];
     $query = $url . '?' . http_build_query($data);
     $header = get_headers($url)[0];
     if (strpos($header, '200 OK') !== false) {
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         curl_setopt($ch, CURLOPT_URL, $query);
         $result = curl_exec($ch);
         curl_close($ch);
         if ($result && ($json = json_decode($result))) {
             if (!empty($json->status) && $json->status == 'error') {
                 return redirect()->back()->withErrors(['api' => 'Помилка підключення до API']);
             }
             return redirect()->back()->withErrors(['done' => true]);
         }
     }
     return redirect()->back()->withErrors(['api' => 'Помилка підключення до API']);
 }
示例#3
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(FeedbackRequest $request)
 {
     $input = $request->except("_token");
     $messages = array('role_id.required' => 'The position field is required.', 'role_id.numeric' => 'The position field is must be a numeric.');
     $validator = Validator::make($input, ['name' => 'required', 'phone' => 'required|numeric|min:0', 'email' => 'required|email', 'company_name' => 'required', 'company_phone' => 'required|numeric', 'company_email' => 'required|email', 'company_address' => 'required', 'role_id' => 'required|numeric|min:0'], $messages);
     if ($validator->fails()) {
         return redirect('feedback')->withErrors($validator)->withInput();
     }
     $this->repo->create($input);
     return redirect('feedback')->with(array('success' => 'Thank you. We Will notify you.'));
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store($id, FeedbackRequest $request)
 {
     $feedback = new Feedback();
     $feedback->rating = $request->count;
     $feedback->comment = $request->comment;
     $feedback->user_id = \Auth::user()->id;
     $feedback->project_id = $request->projectID;
     $myStr = str_random(10);
     if (Input::has('photo')) {
         $imageName = $request->name . '_' . $myStr . '_' . \Auth::user()->id . '.' . $request->file('photo')->getClientOriginalExtension();
         $imageName = $string = str_replace(' ', '', $imageName);
         $imagePath = '/upload/images/' . $imageName;
         $request->file('photo')->move(base_path() . '/public/upload/images/', $imageName);
         $feedback->photo = $imagePath;
     }
     if ($feedback->save()) {
         return redirect('user/feedback/' . $request->projectID);
     } else {
         return 'no';
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(FeedbackRequest $request)
 {
     \App\Feedback::create($request->all());
     $data = array('name' => $request->input('name'));
     \Mail::send('emails.feedback', $data, function ($message) use($request) {
         $message->to($request->input('email'), $request->input('name'))->subject('Thanks for feedback!');
     });
     \Mail::send('emails.feedback', $data, function ($message) use($request) {
         $message->to(\Config::get('mail.admin_email'), $request->input('name'))->subject('Someone left feedback on liverogo! check out');
     });
     flash('Thanks for your valuable feedback.');
     return \Redirect::back();
 }