/**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $feedbacks = Cache::tags(['feedbacks', 'index', 'comments'])->get('feedbacks.index');
     if (!$feedbacks) {
         $feedbacks = Feedback::with('status', 'visibility', 'comments')->get()->sortBy('created_at');
         Cache::tags(['feedbacks', 'index', 'comments'])->put('feedbacks.index', $feedbacks, 1);
     }
     return view('backend.feedbacks.index', ['feedbacks' => $feedbacks]);
 }
예제 #2
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     if (Auth::check()) {
         $title = 'feedback';
         $feedbacks = Feedback::with('user')->get();
         return view('pages.feedback', compact('title', 'feedbacks'));
     } else {
         return redirect('/login');
     }
 }
 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]);
 }
 /**
  * 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]);
 }
예제 #5
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]);
     }
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $feedbacks = Feedback::with('trainer')->distinct()->select('trainer_id')->get();
     $trainers = DB::table('users')->join('role_user', 'users.id', '=', 'role_user.user_id')->where('role_user.role_id', 3)->get();
     return view('feedbacks.index', compact('feedbacks', 'trainers'));
 }
 public function feedbackIndex()
 {
     $feedbacks = Feedback::with('trainer')->distinct()->select('trainer_id')->get();
     $trainers = Trainer::all();
     return view('admin.feedbacks.index', compact('feedbacks', 'trainers'));
 }
예제 #8
0
 /**
  * Главная страница админки городов
  *
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function main()
 {
     return view('admin.feedback.main', ['feedbacks' => Feedback::with('worker')->get()]);
 }