예제 #1
0
 /**
  * @param CategoryRepository $categoryRepository
  * @param string $issue
  *
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function index(CategoryRepository $categoryRepository, $issue)
 {
     $issueArticles = $this->articleRepository->articles($issue);
     $recommendedCategoryId = $categoryRepository->recommendedCategoryIdWithCache();
     $otherCategoryId = $categoryRepository->otherCategoryIdWithCache();
     $recommArticles = [];
     $normalArticles = collect();
     // 创建一个新集合
     $otherArticles = [];
     foreach ($issueArticles as $key => $value) {
         if ($key == $recommendedCategoryId) {
             // 推荐分类文章
             $recommArticles = $value;
         } elseif ($key == $otherCategoryId) {
             // 其他分类文章
             $otherArticles = $value;
         } else {
             $normalArticles = $normalArticles->merge($value);
         }
     }
     // 把推荐分类文章放在集合第一个  其他分类文章放在集合最后一个
     $articles = collect();
     $articles = $articles->merge($recommArticles)->merge($normalArticles)->merge($otherArticles)->groupBy('category_id');
     $latestIssues = $this->issueRepository->getIssues();
     return view('frontend.issues.index', compact('issue', 'articles', 'latestIssues'));
 }
 /**
  * Display the deposer annonce page.
  *
  * @return Response
  */
 public function index(Category $category, Department $department, Region $region)
 {
     $regions = $region->lists();
     $departments = $department->listsWithRegion();
     $categories = $category->lists();
     return view('front.advertisement.add', compact('categories', 'departments', 'regions'));
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  App\Repositories\CategoryRepository $categoryRepository
  * @param  App\Repositories\PeriodRepository $periodRepository
  * @param  int  $id
  * @return Response
  */
 public function edit(CategoryRepository $categoryRepository, PeriodRepository $periodRepository, $id)
 {
     $theme = $this->repository->getByIdWithCategoriesAndPeriods($id);
     $categories = $categoryRepository->getAllSelect();
     $periods = $periodRepository->getAllSelect();
     return view($this->base . '.edit', compact('theme', 'categories', 'periods'));
 }
 public function store(GameRequest $request, CategoryRepository $categoryRepository)
 {
     $inputs = array_merge($request->all(), ['user_id' => $request->user()->id]);
     $game = $this->gameRepository->store($inputs);
     if (isset($inputs['categories'])) {
         $categoryRepository->store($game, $inputs['categories']);
     }
     return redirect(route('game.index'));
 }
 /**
  * Bootstrap the application services.
  *
  * @internal param ProductRepository $productRepository
  * @param ProductRepository $productRepository
  * @param CategoryRepository $categoryRepository
  */
 public function boot(ProductRepository $productRepository, CategoryRepository $categoryRepository)
 {
     view()->composer('categories/partials._list', function ($view) use($categoryRepository) {
         $view->with('categories', $categoryRepository->getParents());
     });
     view()->composer('layouts/partials._header', function ($view) {
         $view->with('currentUser', Auth::user());
     });
     view()->composer('profiles/show', function ($view) {
         $view->with('currentUser', Auth::user());
     });
     view()->composer('profiles/favorites', function ($view) {
         $view->with('currentUser', Auth::user());
     });
     view()->composer('profiles/edit', function ($view) {
         $view->with('currentUser', Auth::user());
     });
     view()->composer('profiles/reviews', function ($view) {
         $view->with('currentUser', Auth::user());
     });
     view()->composer('products/payment', function ($view) {
         $view->with('currentUser', Auth::user());
     });
     view()->composer('products/purchase', function ($view) {
         $view->with('currentUser', Auth::user());
     });
     view()->composer('products/purchase-response', function ($view) {
         $view->with('currentUser', Auth::user());
     });
     view()->composer('products/purchasePaypal-response', function ($view) {
         $view->with('currentUser', Auth::user());
     });
     view()->composer('products/show', function ($view) {
         $view->with('currentUser', Auth::user());
     });
     view()->composer('admin/dashboard/index', function ($view) {
         $view->with('currentUser', Auth::user());
     });
     view()->composer('admin/layouts/partials._navbar', function ($view) {
         $view->with('currentUser', Auth::user());
     });
     /*view()->composer('pages/partials.products', function($view) use ($productRepository){
                 $view->with('products', $productRepository->getFeatured());
             });
     
             view()->composer('layouts/partials.header', function($view) use ($productRepository){
                 $view->with('products', $productRepository->getFeatured());
             });
     
             view()->composer('admin/dashboard/index', function($view) {
                 $view->with('currentUser', Auth::user());
             });
             view()->composer('admin/layouts/partials._navbar', function($view) {
                 $view->with('currentUser', Auth::user());
             });*/
 }
 /**
  * Show the form for editing the specified product.
  *
  * @param  int $id
  * @return Response
  */
 public function edit($id)
 {
     $product = $this->productRepository->findById($id);
     $categories_list = $this->categoryRepository->getParentsAndChildrenList();
     //Category::lists('name', 'id')->all();
     $tags_list = Tag::lists('name', 'id')->all();
     $selected_categories = $product->categories()->select('categories.id AS id')->lists('id')->all();
     $selected_tags = $product->tags()->select('tags.id AS id')->lists('id')->all();
     return View('admin.products.edit')->with(compact('product', 'categories_list', 'tags_list', 'selected_categories', 'selected_tags'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $tu = $this->userRepository->getTotal();
     $tp = $this->productRepository->getTotal();
     $tc = $this->categoryRepository->getTotal();
     $tt = $this->tagRepository->getTotal();
     $op = Option::count();
     $pm = $this->paymentRepository->getTotal();
     return View('admin.dashboard.index')->with(compact('tu', 'tp', 'tc', 'tt', 'op', 'pm'));
 }
예제 #8
0
 /**
  * Update the visibility of a category
  *
  * @param $id
  * @param Request $request
  * @return \Illuminate\Http\JsonResponse
  */
 public function update($id, Request $request)
 {
     $category = $this->categoryRepository->updateVisibility($id, $request->get('visible'));
     //        if($request->get('visible')) {
     //            $category = $this->categoryRepository->updateVisibility($id, true);
     //        } else {
     //            $category = $this->categoryRepository->updateVisibility($id, false);
     //        }
     return response()->json($category, 200);
 }
예제 #9
0
 public function getSearch(CategoryRepository $repository)
 {
     $search = Input::get('q');
     //        $search = 'as';
     //        $cats = [1, 63];
     if ($search) {
         $this->repository->pushCriteria(new SearchQueryCriteria($search));
     }
     //        $this->repository->getByCriteria(new CategoryCriteria($cats));
     //        $this->repository->pushCriteria(new PriceBelowCriteria(5000));
     //        $this->repository->pushCriteria(new PriceAboveCriteria(45000));
     //        return response()->json(count($this->repository->all()));
     return view('pages.search', ['products' => $this->repository->all(), 'categories' => $repository->getFilterCats(), 'searchQuery' => $search]);
 }
예제 #10
0
 protected function excelForOrder($value, $intention)
 {
     // $value is array
     $order['user'] = Auth::user()->id;
     $today = Carbon::now();
     $order['created_at'] = $today->day . '/' . $today->month . '/' . $today->year;
     if (isset($value['tinh_chat'])) {
         $kind = new KindRepository(new Kind());
         $k = $kind->findBy('symbol', $value['tinh_chat'], ['id']);
         // dd($k);
         $order['kind'] = $this->checkObject($k, $kind, ['symbol' => $value['tinh_chat'], 'description' => 'System auto create']);
     } else {
         $order['kind'] = null;
     }
     if (isset($value['loai_dt'])) {
         $category = new CategoryRepository(new Category());
         $c = $category->findBy('symbol', $value['loai_dt'], ['id']);
         $order['category'] = $this->checkObject($c, $category, ['symbol' => $value['loai_dt'], 'description' => 'System auto create']);
     } else {
         $order['category'] = null;
     }
     $unit = new UnitRepository(new Unit());
     $u = $unit->findBy('symbol', $value['don_vi_yc'], ['id']);
     if (isset($u)) {
         $order['unit'] = $u->id;
     } else {
         // create
         $order['unit'] = $unit->create(['description' => 'System auto create', 'symbol' => $value['don_vi_yc'], 'block' => 'AN'])->id;
     }
     $purpose = new PurposeRepository(new Purpose());
     $order['purpose'] = $purpose->findBy('group', $intention, ['id'])->id;
     if (isset($value['ngay_bat_dau']) && isset($value['ngay_ket_thuc'])) {
         $order['date_request'] = $value['ngay_bat_dau']->day . '/' . $value['ngay_bat_dau']->month . '/' . $value['ngay_bat_dau']->year . '-' . $value['ngay_ket_thuc']->day . '/' . $value['ngay_ket_thuc']->month . '/' . $value['ngay_ket_thuc']->year;
     } else {
         $order['date_request'] = null;
     }
     $order['order_phone'] = explode("\n", $value['so_dien_thoai']);
     $order['number_cv'] = $this->checkData('cv_den', $value);
     $order['number_cv_pa71'] = $this->checkData('cv_di', $value);
     $order['order_name'] = $this->checkData('ho_ten_doi_tuong', $value);
     $order['customer_name'] = $this->checkData('ten_ts', $value);
     $order['customer_phone'] = $this->checkData('dien_thoai_ts', $value);
     $order['comment'] = "";
     return $order;
 }
예제 #11
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  App\Http\Requests\PostRequest $request
  * @return Response
  */
 public function store(CategoryRequest $request)
 {
     try {
         $this->category_gestion->store($request->all());
     } catch (Exception $e) {
         echo $e->getMessage();
     }
     return redirect('category')->with('ok', trans('back/category.stored'));
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int $id
  * @return Response
  */
 public function edit($id)
 {
     $product = $this->productRepository->findById($id);
     if (auth()->user()->id != $product->user_id) {
         return redirect()->home();
     }
     $categories_list = $this->categoryRepository->getParentsAndChildrenList(true);
     //Category::lists('name', 'id')->all();
     $tags_list = Tag::select('name', 'price', 'id')->get();
     $options_list = Option::select('name', 'description', 'price', 'id')->get();
     $selected_categories = $product->categories()->select('categories.id AS id')->lists('id')->all();
     $selected_tags = $product->tags()->select('tags.id AS id')->lists('id')->all();
     return view('products.edit')->with(compact('product', 'categories_list', 'tags_list', 'options_list', 'selected_categories', 'selected_tags'));
 }
예제 #13
0
 public function getExportselected($id, Request $request)
 {
     Session::set('exportrec', $id);
     $excelnm = "category_" . date("d-m-Y");
     Excel::create($excelnm, function ($excel) {
         $excel->sheet('Category', function ($sheet) {
             $sheet->mergeCells('A1:W1');
             $sheet->row(1, function ($row) {
                 $row->setFontFamily('Comic Sans MS');
                 $row->setFontSize(30);
             });
             $sheet->row(1, array('Category Report'));
             $sheet->row(2, function ($row) {
                 $row->setFontFamily('Comic Sans MS');
                 $row->setFontSize(15);
                 $row->setFontWeight('bold');
             });
             $sheet->row(2, array('Category Details'));
             /* getting data to display - in my case only one record */
             $ids = Session::get('exportrec');
             $newdatas = explode(",", $ids);
             $gdatalist = $this->category_gestion->getallrecords($newdatas);
             $dataArr = array();
             if (is_array($gdatalist) && count($gdatalist) > 0) {
                 $counter = 0;
                 foreach ($gdatalist as $kyy => $dataval) {
                     $dataArr[$counter]['Sl'] = $counter + 1;
                     $dataArr[$counter]['Category'] = $dataval['name'];
                     $dataArr[$counter]['Slug'] = $dataval['category_slug'];
                     $dataArr[$counter]['Date'] = $dataval['updated_at'];
                     $counter++;
                 }
             }
             /* setting column names for data - you can of course set it manually */
             $sheet->appendRow(array_keys($dataArr[0]));
             /* column names */
             /* getting last row number (the one we already filled and setting it to bold */
             $sheet->row($sheet->getHighestRow(), function ($row) {
                 $row->setFontWeight('bold');
             });
             /* putting users data as next rows */
             foreach ($dataArr as $user) {
                 $sheet->appendRow($user);
             }
         });
     })->export('xls');
 }
예제 #14
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create(CategoryRepository $categoryRepository)
 {
     return view('pages.adposts', ['categories' => $categoryRepository->getCats(), 'emirates' => Emirate::all()]);
 }
예제 #15
0
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle(CategoryRepository $categoryRepository)
 {
     $category = $categoryRepository->update($this->id, $this->params);
     return true;
 }
 public function index($categoryId, ProductRepository $productRepository, CategoryRepository $categoryRepository)
 {
     $categoryName = $categoryRepository->findById($categoryId)->name;
     $products = $productRepository->findByCategory($categoryId);
     return view('categories.products.index', compact('products', 'categoryName'));
 }
예제 #17
0
 public function homePage(ProductRepository $products, CategoryRepository $categories)
 {
     return view('admin.main')->with('products', $products->paginate())->with('cats', $categories->all(['name']))->with('homegrids', HomeGrid::all());
 }
예제 #18
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     $url = config('medias.url');
     return view('back.subcat.create', array_merge(compact('url'), $this->cat_gestion->getAllSelect()));
 }
예제 #19
0
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle(CategoryRepository $categoryRepository)
 {
     $categories = $categoryRepository->paginated(new PaginationParameters($this->params['page'], $this->params['limit']), new FilterParameters($this->params['filters']), new SortParameters($this->params['sort']), []);
     return $categories;
 }
예제 #20
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $this->categoryRepository->delete($id);
     Flash::info('Category deleted');
     return redirect()->back();
 }
예제 #21
0
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle(CategoryRepository $categoryRepository)
 {
     $category = $categoryRepository->delete($this->id);
     return true;
 }
 /**
  * Handle the command.
  *
  * @internal param ImportFromSpreadsheet $command
  */
 public function handle()
 {
     $this->categoryRepository->saveFromList($this->excelImportRepository->getColumn('category'));
     $this->manufacturerRepository->saveFromList($this->excelImportRepository->getColumn('manufacturer'));
     $this->productRepository->saveFromList($this->excelImportRepository->getAllColumns());
 }
예제 #23
0
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle(CategoryRepository $categoryRepository)
 {
     $category = $categoryRepository->save($this->params);
     return $category;
 }
예제 #24
0
 /**
  * Show posts of the given category.
  *
  * @param  Request  $request
  * @param  string  $categoryId
  * @return Response
  */
 public function show(Request $request, $categoryId)
 {
     return view('categories.show', ['category' => $this->categories->categoryInfo($categoryId), 'posts' => $this->categories->categoryPosts($categoryId)]);
 }
예제 #25
0
 /**
  * Update "active" for the specified resource in storage.
  *
  * @param  Illuminate\Http\Request $request
  * @param  int  $id
  * @return Response
  */
 public function updateActive(Request $request, $id)
 {
     $this->cat_gestion->updateActive($request->all(), $id);
     return response()->json();
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $this->categoryRepository->destroy($id);
     Flash::message('Category Deleted');
     return Redirect()->route('categories');
 }
 /**
  * Redirect to categories with default category.
  *
  * @param $id
  * @return \Illuminate\Http\RedirectResponse
  */
 public function showCategory($id)
 {
     $category = $this->category->getById($id);
     return redirect('/categories')->with('default', $category);
 }