示例#1
0
 public function delete_category_by_parent_id($id)
 {
     if (Category::where("parent_id", "=", $id)->delete()) {
         return TRUE;
     }
     return FALSE;
 }
示例#2
0
 public function run()
 {
     $woodworking = App\Category::where('name', 'Woodworking')->first();
     $woodworking->skills()->create(['name' => 'Carpentry', 'description' => 'Making or repairing things in wood', 'created_by_id' => 1, 'approved' => true, 'approved_by_id' => 1]);
     $woodworking->skills()->create(['name' => 'Table Saw', 'description' => 'Using and maintaining a table saw', 'created_by_id' => 1, 'approved' => true, 'approved_by_id' => 1]);
     $woodworking->skills()->create(['name' => 'Bandsaw', 'description' => 'Using and maintaining a band saw', 'created_by_id' => 1, 'approved' => true, 'approved_by_id' => 1]);
     $woodworking->skills()->create(['name' => 'Lathe', 'description' => 'Using and maintaining a lathe', 'created_by_id' => 1, 'approved' => true, 'approved_by_id' => 1]);
     $woodworking->skills()->create(['name' => 'Bandsaw Box', 'description' => 'Making a bandsaw box', 'created_by_id' => 1, 'approved' => true, 'approved_by_id' => 1]);
     $digital = App\Category::where('name', 'Digital Fabrication')->first();
     $digital->skills()->create(['name' => '3D printing', 'description' => 'Repair and use of 3D printers', 'created_by_id' => 1, 'approved' => true, 'approved_by_id' => 1]);
     $digital->skills()->create(['name' => 'Laser Cutter', 'description' => 'Use and maintainence of laser cutters', 'created_by_id' => 1, 'approved' => true, 'approved_by_id' => 1]);
     $electronics = App\Category::where('name', 'Electronics')->first();
     $electronics->skills()->create(['name' => 'PCB Making', 'description' => 'Making printed circuit boards', 'created_by_id' => 1, 'approved' => true, 'approved_by_id' => 1]);
     $electronics->skills()->create(['name' => 'Embedded Programming', 'description' => 'programming embedded systems', 'created_by_id' => 1, 'approved' => true, 'approved_by_id' => 1]);
     $electronics->skills()->create(['name' => 'Soldering', 'description' => 'Soldering', 'created_by_id' => 1, 'approved' => true, 'approved_by_id' => 1]);
     $electronics->skills()->create(['name' => 'Robotics', 'description' => 'Making robots', 'created_by_id' => 1, 'approved' => true, 'approved_by_id' => 1]);
     $technology = App\Category::where('name', 'Technology')->first();
     $technology->skills()->create(['name' => 'Web Programming', 'description' => 'Programming for the web', 'created_by_id' => 1, 'approved' => true, 'approved_by_id' => 1]);
     $technology->skills()->create(['name' => 'PC Building', 'description' => 'Building PCs from components', 'created_by_id' => 1, 'approved' => true, 'approved_by_id' => 1]);
     $arts = App\Category::where('name', 'Arts')->first();
     $arts->skills()->create(['name' => 'Fabrics', 'description' => 'Fabrics', 'created_by_id' => 1, 'approved' => true, 'approved_by_id' => 1]);
     $arts->skills()->create(['name' => 'Photography', 'description' => 'Photography', 'created_by_id' => 1, 'approved' => true, 'approved_by_id' => 1]);
     $science = App\Category::where('name', 'Science')->first();
     $science->skills()->create(['name' => 'Nutrition', 'description' => 'Basic Nutrition', 'created_by_id' => 1, 'approved' => true, 'approved_by_id' => 1]);
     $science->skills()->create(['name' => 'Science?', 'description' => 'Is this even a valid category?', 'created_by_id' => 1, 'approved' => true, 'approved_by_id' => 1]);
 }
 public function index($slug)
 {
     LaravelGettext::setLocale('bg_BG');
     $category = Category::where('slug', $slug)->first();
     $products = Product::where('categories_id', $category->id)->get();
     return view('category.index', compact('products', 'category'));
 }
 public function show($title)
 {
     $category = \App\Category::where('title', '=', $title)->first();
     // dd($category->books());
     $books = $category->books()->get();
     return view('category.category', compact('category', 'books'));
 }
 public function getArticle($cate, $arti)
 {
     $arti = substr($arti, 0, -5);
     //cắt chuối ".html" cuối article alias
     $category = Category::where("category_alias", $cate)->first();
     //lấy category đầu tiên có alias bằng tham số category alias
     $listCategory = Category::all(["id", "category_alias", "category_name"])->toArray();
     $allArticles = Article::all(["id", "title", "alias", "summary", "content", "image", "category_id", "author", "created_date"])->where('category_id', $category["id"])->toArray();
     //lấy tất cả bài viết trong category
     if ($category != null) {
         $message = "";
         $category_name = $category["category_name"];
         if (count($allArticles) == 0) {
             $message = 'Không có bài viết nào.';
         } else {
             $article = Article::where("alias", $arti)->first();
             if ($article != null) {
                 $relateArticles = Article::where('category_id', $category["id"])->where("id", '!=', $article["id"])->orderBy('created_date', 'desc')->get()->take(2)->toArray();
                 return view('front.blog.article', compact('listCategory', 'relateArticles', 'message', 'category_name', 'article', 'mess'));
             } else {
                 $message = "Không tìm thấy bài viết phù hợp";
                 return view('front.blog.error', compact('listCategory', 'message', 'category_name'));
             }
         }
         return view('blog.index', compact('listCategory', 'message', 'category_name'));
     }
 }
示例#6
0
 public function show($slug)
 {
     // Tökum bara síðasta stykkið
     $e = array_filter(explode("/", $slug));
     $last = end($e);
     $item = \App\Category::where('status', 1)->where('slug', $last)->first();
     if ($item) {
         $cats = \App\Category::where('status', 1)->where('parent_id', $item->id)->orderBy('order')->get();
         $prods = \App\Product::where('status', 1)->where('category_id', $item->id)->orderBy('order')->get();
         $data['items'] = $cats->merge($prods);
         $data['pagetitle'] = $item->title;
         $data['seo'] = $item;
         return view('frontend.products')->with($data);
     }
     $item = \App\Product::where('status', 1)->where('slug', $last)->first();
     if (!$item) {
         if (!$item) {
             abort(404, 'Fann ekki síðu!');
         }
     }
     $data['item'] = $item;
     $data['seo'] = $item;
     $data['images'] = $item->img()->all();
     $data['colors'] = $item->skirt()->all();
     $data['image'] = is_array($data['images']) && array_key_exists(0, $data['images']) ? $data['images'][0] : ['name' => $item->img()->first(), 'title' => ''];
     $data['siblings'] = $item->getSiblings();
     $data['pagetitle'] = isset($item->category->title) ? $item->category->title : 'Vörur';
     if ($item->category_id > 1) {
         $data['pagetitle'] = $item->title;
     }
     return view('frontend.product')->with($data);
 }
示例#7
0
 public function getItem($item)
 {
     $item = Furnitura::where('sef', $item)->first();
     $category = Category::where('id', $item->category_id)->first();
     // тут я собираю полный путь к текущей категории для ссылки наверх в категорию
     $tocat = array();
     foreach ($category->getAncestors() as $ancestor) {
         array_push($tocat, $ancestor->sef);
     }
     $tocat = implode('/', $tocat);
     // тут я собираю все картинки товара
     $img = array();
     for ($i = 2; $i < 20; $i++) {
         if (file_exists(public_path() . '/img/furnitura/' . $item->id . '-big-' . $i . '.jpg')) {
             array_push($img, '/img/furnitura/' . $item->id . '-big-' . $i . '.jpg');
         }
     }
     $dwg = array();
     for ($j = 2; $j < 20; $j++) {
         if (file_exists(public_path() . '/img/furnitura/' . $item->artikul . '-dwg-' . $j . '.jpg')) {
             array_push($dwg, '/img/furnitura/' . $item->artikul . '-dwg-' . $j . '.jpg');
         }
     }
     $virez = array();
     for ($k = 2; $k < 20; $k++) {
         if (file_exists(public_path() . '/img/furnitura/' . $item->artikul . '-virez-' . $k . '.jpg')) {
             array_push($virez, '/img/furnitura/' . $item->artikul . '-virez-' . $k . '.jpg');
         }
     }
     $previous = Furnitura::where('No', '<', $item->No)->orderBy('No', 'desc')->first();
     $next = Furnitura::where('No', '>', $item->No)->orderBy('No', 'asc')->first();
     return view('furnitura.item')->withCategory($category)->withItem($item)->withImg($img)->withDwg($dwg)->withVirez($virez)->withPrevious($previous)->withNext($next)->withTocat($tocat);
 }
示例#8
0
 public function store($slug)
 {
     $product = Product::where('slug', $slug)->first();
     $category = Category::where('id', $product->categories_id)->first();
     Cart::add(array('id' => $product->id, 'name' => $product->title, 'price' => $product->price, 'quantity' => 1, 'attributes' => array($product->image_url)));
     return redirect(LaravelLocalization::setLocale() . DIRECTORY_SEPARATOR . "category/{$category->slug}")->with('message', 'Продукта е добавен в количката!');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($name, Request $request)
 {
     $this->validate($request, ['color' => 'required']);
     $category = Category::where('name', $name)->first();
     $category->update($request->all());
     return Redirect("/admin/categories");
 }
 public function getCategorybybranch($branch_id)
 {
     $categoriesName = Category::where('branch_id', '=', $branch_id)->get();
     foreach ($categoriesName as $categoryName) {
         echo "<option value = {$categoryName->id} > {$categoryName->name}</option> ";
     }
 }
示例#11
0
 public function update(Request $request, $id)
 {
     $app = App::find($id);
     $app->name = Input::get('name');
     $app->category_id = Category::where('name', '=', Input::get('class_name'))->pluck('id');
     $app->slogan = Input::get('slogan');
     $app->introduce = Input::get('introduce');
     $app->android = Input::get('android');
     $app->ios = Input::get('ios');
     $app->download = Input::get('download');
     $app->is_check = 1;
     //图片处理
     $tmp_name = $_FILES['logo']['tmp_name'];
     if ($tmp_name) {
         $result_pic = $data['logo'] = FileHandler::uploadPic($tmp_name);
         if ($result_pic['success']) {
             $app->logo = $result_pic['name'];
         } else {
             return Redirect::back()->withInput()->withErrors($result_pic['msg']);
         }
     }
     if ($app->save()) {
         return Redirect::back();
     } else {
         return Redirect::back()->withInput()->withErrors('保存失败!');
     }
 }
 public function categoryModify(Request $request, $id)
 {
     $cat_to_mod = Category::where('id', $id)->first();
     $inputs = $request->except('_token', 'button');
     if ($request->button == 'mod') {
         $x = 0;
         foreach ($inputs as $input) {
             if (!empty($input)) {
                 $x = 1;
             }
         }
         if ($x == 0) {
             return redirect('admin');
         }
         if ($request->name) {
             $cat_to_mod->name = $request->name;
         }
         $cat_to_mod->save();
     }
     if ($request->button == 'del') {
         $item_count = Item::where('category_id', $id)->get()->count();
         if ($item_count >= 1) {
             return redirect('admin')->withErrors('Suppression impossible : des produits appartiennent a cette catgorie');
         }
         $cat_to_mod->delete();
         return redirect('admin')->with('status', 'Catégorie supprimée');
     }
     return redirect('admin')->with('status', 'Modifications de la catégorie enregistrées');
 }
示例#13
0
 public function home()
 {
     //$data['forsidumyndir'] = \App\Page::where('slug', '_forsidumyndir')->first()->getSubs();
     $cats = \App\Category::where('status', 1)->get();
     $prods = \App\Product::where('status', 1)->get();
     $items = [$cats, $prods];
     $kubbar = [];
     foreach ($items as $item) {
         foreach ($item as $v) {
             $frontpaged = trim($v->extras()->get('frontpaged')) ?: 0;
             $size = trim($v->extras()->get('size'));
             $titill = trim($v->extras()->get('titill')) ?: $v->title;
             if ($frontpaged && $frontpaged != 0) {
                 $kubbar[] = ['title' => $titill, 'size' => $size ? $size : 1, 'frontpaged' => $frontpaged, 'fillimage' => $v->fillimage ? true : false, 'path' => $v->fullPath(), 'image' => $v->img()->first(), 'slug' => $v->slug];
             }
         }
     }
     usort($kubbar, function ($a, $b) {
         if ($a['frontpaged'] == $b['frontpaged']) {
             return 0;
         }
         return $a['frontpaged'] < $b['frontpaged'] ? -1 : 1;
     });
     $data['kubbar'] = $kubbar;
     return view('frontend.layout')->with($data);
 }
示例#14
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index($idlevel, $level, $idspeciality, $speciality, $idmaterial, $material, $idlesson, $lesson)
 {
     $newsallarticles = Article::where('stat', '=', 'nouvelles')->orderBy('id', 'desc')->take(3)->get();
     $bacallarticles = Article::where('stat', '=', 'apres-bac')->orderBy('id', 'desc')->take(3)->get();
     $speciality = str_replace('-', ' ', $speciality);
     $material = str_replace('-', ' ', $material);
     $lesson = str_replace('-', ' ', $lesson);
     $lessonnames = Lesson::where('id', '=', $idlesson)->get();
     $specialitynames = Category::where('id', '=', $idspeciality)->get();
     $alllessons = Lesson::groupBy('categories_id')->orderBy('id', 'desc')->get();
     $rounds1 = Lesson::where('round', '=', '1ere-session')->get();
     $rounds2 = Lesson::where('round', '=', '2eme-session')->get();
     $fullcat = Category::get();
     $all = Category::where('parent', '=', 0);
     $level = str_replace('-', ' ', $level);
     $levelnames = Category::where('id', '=', $idlevel)->get();
     $materialnames = Category::where('id', '=', $idmaterial)->get();
     foreach ($lessonnames as $lessonname) {
         $ar_lessonname = $lessonname->ar_title;
     }
     foreach ($specialitynames as $specialityname) {
         $ar_specialityname = $specialityname->ar_name;
     }
     foreach ($levelnames as $levelname) {
         $ar_levelname = $levelname->ar_name;
     }
     foreach ($materialnames as $materialname) {
         $ar_materialname = $materialname->ar_name;
     }
     return view(proj . '.resumes', ['title' => $ar_lessonname, 'ar_materialname' => $ar_materialname, 'ar_levelname' => $ar_levelname, 'rounds1' => $rounds1, 'rounds2' => $rounds2, 'asccat' => $all->get(), 'allcat' => $all->orderBy('id', 'desc')->get(), 'fullcat' => $fullcat, 'idlevel' => $idlevel, 'idspeciality' => $idspeciality, 'idmaterial' => $idmaterial, 'idlesson' => $idlesson, 'level' => $level, 'newsallarticles' => $newsallarticles, 'bacallarticles' => $bacallarticles, 'alllessons' => $alllessons, 'ar_lessonname' => $ar_lessonname, 'lesson' => $lesson, 'material' => $material, 'ar_specialityname' => $ar_specialityname, 'speciality' => $speciality]);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     // Topic
     $topicCategorys = ['Talk', 'Party', 'Movie', 'Music', 'Goods', 'Sport', 'Game'];
     foreach ($topicCategorys as $index => $category) {
         Category::create(['name' => $category, 'type_id' => Category::TYPE_TOPIC]);
     }
     // children Topic
     $topicCategorys = Category::where('type_id', '=', Category::TYPE_TOPIC)->lists('id')->toArray();
     foreach (range(1, 20) as $index) {
         $parentId = $faker->randomElement($topicCategorys);
         $name = Category::find($parentId)->name;
         Category::create(['name' => $name . $index, 'type_id' => Category::TYPE_TOPIC, 'parent_id' => $parentId]);
     }
     // Article
     $articleCategorys = ['Hot News', 'BeiJing', 'China', 'America', 'England'];
     foreach ($articleCategorys as $index => $category) {
         Category::create(['name' => $category, 'type_id' => Category::TYPE_ARTICLE]);
     }
     // Blog
     $blogCategorys = ['Uncategory', 'Log', 'Heavy'];
     foreach ($blogCategorys as $index => $category) {
         Category::create(['name' => $category, 'type_id' => Category::TYPE_BLOG]);
     }
 }
示例#16
0
 public function browse(Request $request, $category = null)
 {
     // get categories
     $categories = Category::orderBy('id', 'desc')->get();
     // get jobs
     if ($category != null) {
         $cat = Category::where('name', '=', $category)->first();
         $jobs = $cat->jobs;
     } else {
         $jobs = Jobs::query();
         // set condition category
         if ($request->has('category')) {
             $cat = Category::where('name', '=', $request->get('category'))->first();
             $jobs = $cat->jobs();
         }
         // set condition state
         if ($request->has('state')) {
             $jobs->where('state', '=', $request->get('state'));
         }
         // set condition keywords
         if ($request->has('keywords')) {
             $searchWords = explode(' ', $request->get('keywords'));
             foreach ($searchWords as $word) {
                 $jobs->orWhere('description', 'LIKE', '%' . $word . '%');
             }
         }
         $jobs = $jobs->orderBy('id', 'desc')->get();
     }
     return view('jobs.browse')->with('jobs', $jobs)->with('jobsCount', Jobs::count())->with('categories', $categories);
 }
示例#17
0
 public function show($slug)
 {
     // Tökum bara síðasta stykkið
     $e = array_filter(explode("/", $slug));
     $last = end($e);
     $item = \App\Category::where('status', 1)->where('slug', $last)->first();
     if ($item) {
         $cats = \App\Category::where('status', 1)->where('parent_id', $item->id)->orderBy('order')->get();
         $prods = \App\Product::where('status', 1)->where('category_id', $item->id)->orderBy('order')->get();
         $data['items'] = $cats->merge($prods);
         $data['title'] = $item->title;
         return view('frontend.products')->with($data);
     }
     $item = \App\Product::where('status', 1)->where('slug', $last)->first();
     if (!$item) {
         if (!$item) {
             abort(404, 'Fann ekki síðu!');
         }
     }
     $data['item'] = $item;
     $data['siblings'] = $item->getSiblings();
     $data['title'] = isset($item->category->title) ? $item->category->title : 'Vörur';
     if ($item->category_id < 1) {
         $data['title'] = $item->title;
     }
     return view('frontend.product')->with($data);
 }
示例#18
0
 public function showProjects($category)
 {
     $category = Category::where('slug', $category)->first();
     $profiles = Profile::where('category_id', $category->id)->take(5)->get();
     $posts = Post::where('category_id', $category->id)->where('status', 1)->orderBy('id', 'DESC')->paginate(10);
     return view('tender.posts', compact('category', 'profiles', 'posts'));
 }
示例#19
0
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     /*view()->share('categories', Category::all());*/
     view()->composer('layouts.partials.categories', function ($view) {
         $view->with('categories', Category::where('parent_id', 0)->get());
     });
 }
示例#20
0
 /**
  * Created By Dara on 13/12/2015
  * show the result of the search
  */
 public function searchProcess(Request $request)
 {
     $this->validate($request, ['type' => 'required|integer|in:1,2', 'sort' => 'required|integer', 'category' => 'required|integer']);
     $firstCategoryQuery = Category::where('parent_id', null);
     $categorySelect = $firstCategoryQuery->lists('name', 'id');
     $input = $request->except('_token');
     $results = [];
     //bindings process
     $bind = new \stdClass();
     $bind->type = $input['type'];
     $bind->sort = $input['sort'];
     $bind->category = $input['category'];
     $firstCategory = Category::where('id', $request->input('category'))->first();
     $limit = 20;
     if ($input['type'] == 1) {
         //search for user is selected
         $type = 'user';
         $sortSelect = [1 => 'پر ستاره ترین ها', 2 => 'پر بازدید ترین ها', 3 => 'پر مشتری ترین ها', 4 => 'جدید ترین ها', 5 => 'پیشنهاد ویژه'];
         $results[$firstCategory->id . $firstCategory->name] = $this->userSqlQuery($firstCategory, $limit, $input['sort']);
     } elseif ($input['type'] == 2) {
         //search for product selected
         $sortSelect = [6 => 'محبوب ترین ها', 7 => 'پر فروش ترین ها', 8 => 'پر بازدید ترین ها', 9 => 'جدید ترین ها'];
         $results[$firstCategory->id . $firstCategory->name] = $this->productSqlQuery($firstCategory, $limit, $request->input('sort'));
         $type = 'product';
     }
     return view('top.index', compact('results'))->with(['title' => 'برترین ها', 'type' => $type, 'categorySelect' => $categorySelect, 'sortSelect' => $sortSelect, 'bind' => $bind]);
 }
示例#21
0
 public function pesok()
 {
     $category = Category::where('sef', '=', 'catalogs')->first();
     $path = explode("?", substr($_SERVER['REQUEST_URI'], 1));
     $link = Link::where('url', $path[0])->first();
     // удалить первый слеш из URI и вернуть строку до первого вхождения знака ?
     // иначе на второй и следующей странице пагинации переменная $link будет содержать всякий хлам
     // типа ?page=4 и естесственно в БД такой ссылки не найдется
     $img = File::allFiles(public_path() . '/img/risunki/pesok');
     // pagination нашел тута  http://psampaz.github.io/custom-data-pagination-with-laravel-5/
     //Get current page form url e.g. &page=6
     $currentPage = LengthAwarePaginator::resolveCurrentPage();
     if (is_null($currentPage)) {
         $currentPage = 1;
     }
     //Create a new Laravel collection from the array data
     $collection = new Collection($img);
     //Define how many items we want to be visible in each page
     $perPage = 20;
     //Slice the collection to get the items to display in current page
     $currentPageImgResults = $collection->slice(($currentPage - 1) * $perPage, $perPage)->all();
     //Create our paginator and pass it to the view
     $paginatedImgResults = new LengthAwarePaginator($currentPageImgResults, count($collection), $perPage);
     $paginatedImgResults->setPath('peskostrujnie-risunki');
     return view('links.pesok')->withCategory($category)->withLink($link)->withImg($paginatedImgResults)->withPath($path);
 }
示例#22
0
 public function getCourseInCategory($category_slug, $course_slug)
 {
     $category = Category::where('slug', $category_slug)->first();
     // find id of slug
     $matchThese = ['category_id' => $category->id, 'slug' => $course_slug];
     $course = Course::where($matchThese)->first();
     return view('courses.show')->with('course', $course);
 }
示例#23
0
 public function get()
 {
     $head_categories = Category::where('trash', '=', 0)->where('parent_id', '=', 0)->get();
     foreach ($head_categories as $key => $category) {
         $this->categories[$category->name] = Category::where('parent_id', '=', $category->id)->get();
     }
     return $this->categories;
 }
示例#24
0
 public function getCategoria($slug)
 {
     // articoli di una specifica categoria
     $categories = \App\Category::all();
     $currentCategory = \App\Category::where('slug', '=', $slug)->first();
     $articles = $currentCategory->articles()->where('published_at', '<=', 'NOW()')->where('is_published', '=', true)->orderBy('published_at', 'DESC')->paginate(5);
     return view('blog.category', compact('currentCategory', 'articles'));
 }
示例#25
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($slug)
 {
     $category = Category::where('slug', $slug)->first();
     $articles = $category->articles()->get();
     $categories = Category::all();
     $tags = Tag::all();
     return view('articles.categories.show', compact('articles', 'categories', 'tags'));
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request)
 {
     $category = Category::where('id', $request['categoryID'])->first();
     $category->name = $request['name'];
     $category->save();
     \Session::flash('success', $request['name'] . ' has been successfully updated!');
     return redirect()->back();
 }
示例#27
0
 public function category($name)
 {
     $content = Category::where('url', $name)->first();
     $products = $content->products()->get();
     $currency = session('currency');
     //$currency = 'BYR';
     return view('template.categoryDisplay', compact('content', 'products', 'currency'));
 }
示例#28
0
 public function getItem($cat, $item)
 {
     $category = Category::where('sef', '=', $cat)->first();
     $item = FAQ::where('sef', $item)->first();
     $previous = FAQ::where('id', '<', $item->id)->orderBy('id', 'desc')->first();
     $next = FAQ::where('id', '>', $item->id)->orderBy('id', 'asc')->first();
     return view('faq.item')->withCategory($category)->withItem($item)->withPrevious($previous)->withNext($next);
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index($id)
 {
     $products = Product::where('category_id', $id)->get();
     $sliders = Slider::all();
     $categories = Category::all();
     $current_category = Category::where('id', $id)->get()[0];
     return view('category', compact('sliders', 'categories', 'products', 'current_category'));
 }
示例#30
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $servers = Server::paginate(1);
     $news = Category::where('type', NEWS_CAT)->where('status', 1)->first();
     $galaries = Galary::where('status', 1)->get();
     $articles = Category::getPostAvaiable($news);
     return view('frontend.index.main')->with('news_articles', $articles)->with('news', $news)->with("galaries", $galaries)->with('servers', $servers);
 }