Пример #1
0
 public function accept($id)
 {
     $offer = Offer::find($id);
     $post = Post::find($offer->post_id);
     $post->sold = $id;
     $post->save();
     $user = User::findOrFail($offer->user_id);
     $poster = User::findOrFail($offer->post_creator);
     $feedback_seller = new Feedback();
     $feedback_seller->post_id = $offer->post_id;
     $feedback_seller->giver_id = $offer->user_id;
     $feedback_seller->receiver_id = $offer->post_creator;
     $feedback_seller->type = 'seller';
     $feedback_seller->save();
     $feedback_buyer = new Feedback();
     $feedback_buyer->post_id = $offer->post_id;
     $feedback_buyer->giver_id = $offer->post_creator;
     $feedback_buyer->receiver_id = $offer->user_id;
     $feedback_buyer->type = 'buyer';
     $feedback_buyer->save();
     Mail::send('emails.offerAccepted', ['user' => $user, 'offer' => $offer, 'poster' => $poster, 'feedback' => $feedback_buyer], function ($m) use($user) {
         $m->to($user->email, $user->name)->subject('Offer Accepted!');
     });
     Mail::send('emails.listingSold', ['user' => $user, 'offer' => $offer, 'poster' => $poster, 'feedback' => $feedback_seller], function ($m) use($user) {
         $m->to($poster->email, $poster->name)->subject('Listing Sold!');
     });
     return Redirect($post->community_id . '/post/' . $post->id)->with('message', 'Offer Accepted');
 }
 public function feed(Request $request)
 {
     if ($request->content == '') {
         return redirect('/feedback');
     }
     $user = new Feedback();
     $user->feed = $request->content;
     $user->save();
     return redirect('/');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(FeedbackFormRequest $request)
 {
     $traineeId = Auth::user()->id;
     $feedback = new Feedback(array('trainer_id' => $request->get('trainer_id'), 'trainee_id' => $traineeId, 'voice_range' => $request->get('A1'), 'voice_clearity' => $request->get('A2'), 'communication_skills' => $request->get('A3'), 'rapport_building' => $request->get('A4'), 'interaction' => $request->get('A5'), 'topic_usefulness' => $request->get('B1'), 'material_organization' => $request->get('B2'), 'speakers_knowledge' => $request->get('B3'), 'comments' => $request->get('comments')));
     //dd($feedback);
     if (Feedback::where('trainee_id', '=', $traineeId)->where('trainer_id', '=', $request->get('trainer_id'))->exists()) {
         return redirect('/trainee')->with('status', 'You have already given feedback');
     } else {
         $feedback->save();
         return redirect('/trainee')->with('status', 'Your feedback has been submitted!');
     }
 }
Пример #4
0
 public function store(Request $request, Feedback $feedback, SendMailController $sendMailController)
 {
     $messages = ['required' => 'Поле  должно быть заполнено.', 'email' => 'Некорректно введенный email', 'max:255' => 'Максимально допустимое значение 255 символов', 'captcha' => 'Введите правильно символы с картинки!'];
     $v = Validator::make($request->all(), ['name' => 'required|max:255', 'email' => 'required|email', 'message' => 'required', 'captcha' => 'required|captcha'], $messages);
     if ($v->fails()) {
         return redirect()->back()->withErrors($v->errors())->withInput();
     } else {
         $feedback->insertFeedback($request->all());
         $sendMailController->sendFeedbackToAdmin($request->all());
         //Input::clearResolvedInstances();
         $info = "Спасибо за вопрос, в ближайшее время мы Вам ответим!";
         return redirect()->route('feedbackCreate', [$info]);
     }
 }
Пример #5
0
 /**
  * Сохдраняем в БД отзыв
  * @param Request $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function saveFeedback(Request $request)
 {
     $this->validate($request, ['email' => 'required|email', 'text' => 'required', 'worker' => 'integer', 'file' => 'file']);
     $feedback = new Feedback();
     $feedback->text = "E-mail: " . $request->email . "\r\nText: " . $request->text;
     $feedback->worker_id = $request->worker;
     if ($request->hasFile('file')) {
         $file = uniqid() . '.' . $request->file('file')->getClientOriginalExtension();
         $request->file('file')->move(public_path('upload/'), $file);
         $feedback->file = $file;
     }
     $feedback->save();
     $request->session()->flash('done', '1');
     return redirect()->route('feedback');
 }
 function store(Requests\createFeedbackRequest $request)
 {
     $input = Request::all();
     $input['published_at'] = Carbon::now();
     Feedback::create($input);
     return redirect('feedback');
 }
Пример #7
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     for ($i = 1; $i < 40; $i++) {
         Feedback::create(['user_id' => 1, 'message_id' => rand(1, 30), 'body' => 'body' . $i]);
     }
 }
 /**
  * Register any other events for your application.
  *
  * @param  \Illuminate\Contracts\Events\Dispatcher  $events
  * @return void
  */
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     Feedback::created(function ($item) {
         Cache::tags('feedbacks')->flush();
         $this->dispatch(new SentenceProcessing($item));
     });
     Feedback::updated(function ($item) {
         Cache::tags('feedbacks')->flush();
     });
     Feedback::deleted(function ($item) {
         Cache::tags('feedbacks')->flush();
     });
     Comment::saved(function ($item) {
         Cache::tags('comments')->flush();
     });
     Comment::saved(function ($item) {
         Cache::tags('comments')->flush();
     });
     Sentence::saved(function ($item) {
         if ($item->feedback) {
             $item->feedback->calculateProbabilities();
         }
     });
 }
Пример #9
0
 public function storeFeedback(Request $request)
 {
     $feedback = Feedback::find($request->feedback_id);
     $feedback->positive = $request->positive;
     $feedback->save();
     return Redirect('/')->with('message', 'Feedback Has Been Saved, Thank You!');
 }
Пример #10
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $feedback = new Feedback();
     $feedback->user_id = Auth::user()->id;
     $feedback->experience = $request['experience'];
     $feedback->usability = $request['usability'];
     $feedback->comments = $request['comments'];
     $feedback->promotion = $request['promotion'];
     $feedback->device_info = $request['device_info'];
     if ($request['concerns'] != null) {
         $feedback->concerns = implode(', ', $request['concerns']);
     }
     $feedback->refer = $request['refer'];
     $feedback->save();
     Session::flash('message', 'Thanks for giving your valuable feedback!');
     Session::flash('alert-class', 'alert-success');
     return response()->json(['success' => 'success']);
 }
Пример #11
0
 public function create()
 {
     if (Request::isMethod('get')) {
         return view('pages.feedback.create');
     } elseif (Request::isMethod('post')) {
         $feedback = Feedback::create(Input::all());
         return redirect('/');
     }
 }
 public function storeFeedback(FeedbackFormRequest $request)
 {
     $user_id = $request->input('user_id');
     $product_id = $request->input('product_id');
     $nickname = $request->input('nickname');
     $heading = $request->input('heading');
     $content = $request->input('content');
     Feedback::create(['user_id' => $user_id, 'product_id' => $product_id, 'nickname' => $nickname, 'heading' => $heading, 'content' => $content]);
     return redirect()->route('detail', compact('product_id'));
 }
Пример #13
0
 public function store()
 {
     $data = Input::all();
     $validation = Validator::make($data, $this->rules);
     if ($validation->passes()) {
         Feedback::addApplication($data);
     } else {
         //Feedback::addApplication($data);
         return 'ошибка';
     }
 }
 public function index()
 {
     $feedbacks = Cache::tags(['feedbacks', 'index', 'notClosed', 'comments'])->get('feedbacks.index.notClosed');
     if (!$feedbacks) {
         $feedbacks = Feedback::with('status', 'visibility', 'comments')->isNotStatus('closed')->get()->sortByDesc(function ($feedback, $key) {
             return $feedback->probabilities[0];
         });
         Cache::tags(['feedbacks', 'index', 'notClosed', 'comments'])->put('feedbacks.index.notClosed', $feedbacks, 1);
     }
     return view('backend.dashboard', ['feedbacks' => $feedbacks]);
 }
 /**
  * Сохранение отзыва
  * @param Request $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function postFeedback(Request $request)
 {
     $text = $request->get('text', '');
     if (!empty($text) && strlen($text) > 10 && strlen($text) < 1000) {
         $user_id = Auth::user()->id;
         $feedback = Feedback::create(['user_id' => $user_id, 'text' => $text]);
         if ($feedback) {
             return redirect('/feedback')->with('message', 'Ваш запрос успешно отправлен.');
         }
     }
     return redirect('/feedback')->with('errors', 'Введите текст запроса (не менее 10 символов).');
 }
Пример #16
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $user = \Auth::user();
     $project = \App\Project::find($id);
     $users = \App\Project::find($id)->projectUser;
     $projectUsers = [];
     foreach ($users as $u) {
         $projectUsers[] = \App\User::find($u->user_id);
     }
     $feedbacks = \App\Feedback::where('user_id', '=', $user->id)->orWhere('project_id', '=', $id)->get();
     return view('user.feedback.projectfeedback', compact('project', 'user', 'feedbacks'));
 }
Пример #17
0
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function dashboard()
 {
     $user = User::find(Auth::user()->id);
     $communitys = Community::all()->lists('name', 'id');
     $feedbacksGiven = Feedback::where('giver_id', Auth::user()->id)->get();
     $feedbacks = Feedback::where('receiver_id', Auth::user()->id)->get();
     $activePosts = Post::where('user_id', Auth::user()->id)->where('sold', null)->get();
     $offers = Offer::where('post_creator', Auth::user()->id)->whereHas('post', function ($q) {
         $q->where('sold', NULL);
     })->orderBy('created_at', 'desc')->get();
     return view('pages.dashboard', ['user' => $user, 'communities' => $communitys, 'offers' => $offers, 'feedbacks' => $feedbacks, 'activePosts' => $activePosts, 'feedbacksGiven' => $feedbacksGiven]);
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $feedback = Cache::tags(['feedbacks', 'show'])->get('feedbacks.show.' . $id);
     if (!$feedback) {
         $feedback = Feedback::with('status')->isPublic()->find($id);
         Cache::tags(['feedbacks', 'show'])->put('feedbacks.show.' . $id, $feedback, 1);
     }
     if (!$feedback) {
         return abort(404);
     }
     return view('frontend.feedbacks.show', ['feedback' => $feedback]);
 }
Пример #19
0
 /**
  * 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();
 }
Пример #20
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     DB::table('users')->delete();
     $users = [['firstname' => 'Ryan', 'lastname' => ' Reynolds', 'email' => '*****@*****.**', 'gender' => 'male', 'username' => 'ryan', 'orientation' => 'straight', 'birthday' => '1994-08-01', 'country' => 'Sri Lanka', 'role' => 'user', 'password' => Hash::make('rR12356')], ['firstname' => 'Roam', 'lastname' => ' Guptil', 'email' => '*****@*****.**', 'gender' => 'male', 'username' => 'roam', 'orientation' => 'straight', 'birthday' => '1994-08-01', 'country' => 'Sri Lanka', 'role' => 'user', 'password' => Hash::make('rR12356')], ['firstname' => 'Relative', 'lastname' => ' Zuckerberg', 'email' => '*****@*****.**', 'gender' => 'male', 'username' => 'batman', 'orientation' => 'straight', 'birthday' => '1994-08-01', 'country' => 'Sri Lanka', 'role' => 'user', 'password' => Hash::make('rR12356')], ['firstname' => 'Ryan', 'lastname' => ' Higa', 'email' => '*****@*****.**', 'gender' => 'male', 'username' => 'higa', 'orientation' => 'straight', 'birthday' => '1994-08-01', 'country' => 'Sri Lanka', 'role' => 'user', 'password' => Hash::make('rR12356')], ['firstname' => 'Rnp', 'lastname' => ' Harrison', 'email' => '*****@*****.**', 'gender' => 'male', 'username' => 'rnp', 'orientation' => 'straight', 'birthday' => '1994-08-01', 'country' => 'Sri Lanka', 'role' => 'user', 'password' => Hash::make('rR12356')], ['firstname' => 'Resmond', 'lastname' => ' Lost', 'email' => '*****@*****.**', 'gender' => 'male', 'username' => 'resmond', 'orientation' => 'straight', 'birthday' => '1994-08-01', 'country' => 'Sri Lanka', 'role' => 'user', 'password' => Hash::make('rR12356')], ['firstname' => 'Renal', 'lastname' => ' Queen', 'email' => '*****@*****.**', 'gender' => 'male', 'username' => 'widow', 'orientation' => 'straight', 'birthday' => '1994-08-01', 'country' => 'Sri Lanka', 'role' => 'user', 'password' => Hash::make('rR12356')], ['firstname' => 'Reymond', 'lastname' => ' Stone', 'email' => '*****@*****.**', 'gender' => 'male', 'username' => 'stone', 'orientation' => 'straight', 'birthday' => '1994-08-01', 'country' => 'Sri Lanka', 'role' => 'user', 'password' => Hash::make('rR12356')], ['firstname' => 'Chris', 'lastname' => 'james', 'email' => '*****@*****.**', 'gender' => 'male', 'username' => 'chris', 'orientation' => 'straight', 'birthday' => '1994-08-01', 'country' => 'Sri Lanka', 'role' => 'user', 'password' => Hash::make('cC123456')], ['firstname' => 'Han', 'lastname' => 'Solo', 'email' => '*****@*****.**', 'gender' => 'male', 'username' => 'alo', 'orientation' => 'straight', 'birthday' => '1994-08-01', 'country' => 'Sri Lanka', 'role' => 'user', 'password' => Hash::make('rR12356')], ['firstname' => 'Tiffany', 'lastname' => 'Hwang', 'email' => '*****@*****.**', 'gender' => 'female', 'username' => 'tiffany', 'orientation' => 'straight', 'birthday' => '1994-08-01', 'country' => 'Sri Lanka', 'role' => 'user', 'password' => Hash::make('tT123456')], ['firstname' => 'Isuru', 'lastname' => ' Dilhan', 'email' => '*****@*****.**', 'job' => 'Web developer', 'superAdmin' => 'yes', 'role' => 'admin', 'password' => Hash::make('Secret123/')]];
     // Loop through each user above and create the record for them in the database
     foreach ($users as $user) {
         User::create($user);
     }
     $feedbacks = [['user' => 'Ryan', 'category' => 'timeline', 'description' => 'Awsome'], ['user' => 'Chris', 'category' => 'activity', 'description' => 'Superb'], ['user' => 'Alo', 'category' => 'chat', 'description' => 'nice emojies'], ['user' => 'Tiffany', 'category' => 'privacy', 'description' => 'She is annoying'], ['user' => 'Isuru', 'category' => 'other', 'description' => 'Nice quiz']];
     foreach ($feedbacks as $feedback) {
         Feedback::create($feedback);
     }
     Model::reguard();
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $feedbacks = Feedback::where('trainer_id', '=', $id)->with('trainer')->join('trainers', 'trainers.id', '=', 'feedbacks.trainer_id')->select('*', DB::raw('AVG(voice_range) as voice_range,
                         AVG(voice_clearity) as voice_clearity,
                         AVG(communication_skills) as communication_skills,
                         AVG(rapport_building) as rapport_building,
                         AVG(topic_usefulness) as topic_usefulness,
                         AVG(interaction) as interaction,
                         AVG(material_organization) as material_organization,
                         AVG(speakers_knowledge) as speakers_knowledge'))->get();
     foreach ($feedbacks as $f) {
         $sum = $f->voice_range + $f->voice_clearity + $f->communication_skills + $f->rapport_building + $f->topic_usefulness + $f->interaction + $f->material_organization + $f->speakers_knowledge;
     }
     $avg = $sum / 8;
     return view('feedbacks.show', compact('feedbacks', 'avg'));
 }
Пример #22
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     $keyword = trim($request->input('keyword'));
     $field_date = trim($request->input('field_date')) ? 'desc' : 'asc';
     $field_today = trim($request->input('field_today')) ? true : false;
     // 在用户昵称, 手机号, 电子邮箱中查询关键字
     $feedbacks = Feedback::WhereHas('user', function ($query) use($keyword) {
         $query->where('nickname', 'like', "%{$keyword}%")->orWhere('cellphone', 'like', "%{$keyword}%")->orWhere('email', 'like', "%{$keyword}%");
     });
     // 在当天中查找记录
     if ($field_today) {
         $feedbacks->whereBetween('created_at', [Carbon::now()->startOfDay(), Carbon::now()->endOfDay()]);
     }
     // 按创建时间排序并分页
     $feedbacks = $feedbacks->orderBy('created_at', $field_date)->paginate(10);
     return view('feedback.index', compact('feedbacks'));
 }
Пример #23
0
 /**
  * Bind data to the view.
  *
  * @param  View  $view
  * @return void
  */
 public function compose(View $view)
 {
     $categories = Category::with('children', 'products')->where('parent_id', '=', 0)->orderBy('did')->get();
     $hotpros_id = Salesstats::groupBy('product_id')->take(16)->get();
     $hotpros_id = $hotpros_id->lists('product_id');
     $hotpros = Product::with('images')->has('images')->has('prices')->wherein('id', $hotpros_id)->take(16)->get();
     $globals = DB::table('globalsettings')->get();
     $dts = DB::table('deliverytimes')->where('active', true)->get();
     foreach ($dts as $dt) {
         $dt->start = Carbon::parse($dt->start)->format('h:ia');
         $dt->stop = Carbon::parse($dt->stop)->format('h:ia');
     }
     $settings = [];
     foreach ($globals as $global) {
         $name = $global->name;
         $value = $global->value;
         $settings[$name] = $value;
     }
     $offers = Offer::with(['categories', 'categories.products' => function ($q) {
         $q->has('images');
     }, 'brands', 'brands.products' => function ($q) {
         $q->has('images');
     }, 'products' => function ($q) {
         $q->has('images');
     }, 'products.images', 'products.prices'])->where('active', true)->where('start', '<=', Carbon::today()->toDateString())->where('end', '>=', Carbon::today()->toDateString())->take(16)->get();
     //dd($offers);
     $feedbacks = Feedback::with('user')->take(8)->get();
     if ($user = Sentinel::check()) {
         $user = User::findorfail($user->id);
         $flashes = Flashtext::where('active', '1')->get();
         $areas = Area::where('deliverable', '1')->get();
         $viewpros_id = Viewstats::where('user_id', $user->id)->take(16)->get();
         //dd($viewpros_id);
         $viewpros_id = $viewpros_id->lists('product_id');
         $viewpros = Product::with('images')->has('images')->has('prices')->wherein('id', $viewpros_id)->take(16)->get();
         $view->with(['user' => $user, 'flashes' => $flashes, 'areas' => $areas, 'hotpros' => $hotpros, 'viewpros' => $viewpros, 'offers' => $offers, 'settings' => $settings, 'dts' => $dts, 'feedbacks' => $feedbacks, 'categories' => $categories]);
     } else {
         $flashes = Flashtext::where('active', '1')->get();
         $areas = Area::where('deliverable', '1')->get();
         $viewpros_id = Viewstats::where('user_id', 0)->take(16)->get();
         $viewpros_id = $viewpros_id->lists('product_id');
         $viewpros = Product::with('images')->has('images')->has('prices')->wherein('id', $viewpros_id)->take(16)->get();
         $view->with(['flashes' => $flashes, 'areas' => $areas, 'hotpros' => $hotpros, 'viewpros' => $viewpros, 'offers' => $offers, 'settings' => $settings, 'dts' => $dts, 'feedbacks' => $feedbacks, 'categories' => $categories]);
     }
 }
Пример #24
0
 public function newfeedback(Request $request)
 {
     $this->validate($request, ['feedback' => 'required|min:10']);
     $user = Sentinel::check();
     $user = User::findorfail($user->id);
     if ($request->ajax()) {
         $feedback = ['user_id' => $user->id, 'feedback' => $request->feedback];
         $hasfeedback = Feedback::where('user_id', $user->id)->first();
         if ($hasfeedback) {
             $hasfeedback->feedback = $request->feedback;
             $hasfeedback->save();
         } else {
             Feedback::create($feedback);
         }
         return response()->json(['success' => 'posted feedback']);
     }
     return redirect()->route('home');
 }
 public function detail($id)
 {
     $number_of_items = Cart::content();
     $product = Product::find($id);
     // Tìm sản phẩm có ID như trên trong database để lấy dữ liệu
     $type = Type::all();
     // Lấy tất cả các loại sp
     $users = User::all();
     // Lấy tất cả các người dùng
     $feedbacks = Feedback::where('product_id', '=', $id)->get();
     // Hiển thị những Feedback có id Sản phẩm như trên
     $rate_stars = DB::table('rates')->where('product_id', '=', $id)->avg('rate');
     // Tính trung bình đánh giá của sp đó
     $related_product = Product::where('type_id', '=', $product->type_id)->orderByRaw('RAND()')->take(4)->get();
     // Hiển thị những sản phẩm liên quan, cùng loại
     if ($product->sale_price != 0) {
         $price = $product->sale_price;
     } else {
         $price = $product->price;
     }
     return view('webcontent/detail', compact('product', 'price', 'type', 'related_product', 'number_of_items', 'feedbacks', 'users', 'rate_stars'));
 }
 /**
  * 获取feedback_info
  */
 public function feedback_info($id)
 {
     return Feedback::find($id);
 }
Пример #27
0
 public function delete_feedback($feedback_id)
 {
     $feedback = Feedback::find($feedback_id);
     if ($feedback->delete()) {
         $message = 'Сообщение удалено!';
     } else {
         $message = 'Произошла ошибка, попробуйте снова!';
     }
     session()->flash('message', $message);
     return redirect()->back();
 }
 /**
  * Supprimer le feedback de l'offre de stage
  * @param $id
  * @return mixed
  */
 public function delete($id)
 {
     $feedback = Feedback::find($id);
     $feedback->delete();
     return Redirect::to('etudiant/historique-feedback');
 }
Пример #29
0
 /**
  * posts feedback from users.
  *
  * @param id        $request
  *
  * @return json
  */
 public function postFeedback(Request $request)
 {
     $username = $request->username;
     $description = $request->comment;
     $category = $request->type;
     $feedback = new Feedback();
     $feedback->user = $username;
     $feedback->description = $description;
     $feedback->category = $category;
     if ($feedback->save()) {
         return response()->json(['status' => 200, 'done' => true], 200);
     } else {
         return response()->json(['status' => 200, 'done' => false], 200);
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $feedback = Feedback::find($id);
     $feedback->delete();
     return $feedback;
 }