コード例 #1
0
ファイル: ProductController.php プロジェクト: dhduc/shopui
 public function product($id)
 {
     // Product Detail
     $product = Product::find($id);
     $producer = Producer::find($product->producer);
     $producerItem = "<a href='" . URL::to('/') . "/producer/" . $producer->id . "/" . strtolower($producer->producer) . ".html'>" . $producer->producer . "</a>";
     // Category
     $productCategoryID = Product::find($id)->category_id;
     // breadcrumb
     $breadcrumb = $this->breadcrumb($productCategoryID, $id);
     // Best Seller
     $bestSeller = $this->bestSeller();
     $image = Images::where('productID', $product['id'])->first();
     $thumbnail = $image['imageSrc'];
     $thumbnailImage = '<a class="preView" rel="' . URL::to('/') . '/' . $thumbnail . '"><img src="' . URL::to('/') . '/' . $thumbnail . '" alt="" class="img-responsive"></a>';
     $images = Images::where('productID', $id)->get();
     $listImages = "";
     foreach ($images as $image) {
         $img = $image['imageSrc'];
         $listImages .= '<a href="' . URL::to('/') . '/' . $img . '" class="fancybox-button" rel="photos-lib"><img alt="Berry Lace Dress" src="' . URL::to('/') . '/' . $img . '"></a>';
     }
     $review = '<div class="fb-comments" data-href="' . URL::to('/') . '/product/' . $id . '"
             data-num-posts="10" data-width="700px"></div>';
     return view('home.product.detail')->with(['breadcrumb' => $breadcrumb, 'product' => $product, 'producer' => $producerItem, 'bestSeller' => $bestSeller, 'thumbnailImage' => $thumbnailImage, 'listImages' => $listImages, 'review' => $review]);
 }
コード例 #2
0
ファイル: SliderController.php プロジェクト: dhduc/shopui
    public function index()
    {
        $images = Images::where('imageType', "slider")->get();
        $productView = "";
        foreach ($images as $image) {
            $productView .= '<tr><td>
                        ' . $image['id'] . '
                    </td>
                    <td>
                        <img src="' . URL::to('/') . '/' . $image['imageSrc'] . '" width="100px" height="100px" />
                    </td>
                    <td>
                        ' . $image['imageName'] . '
                    </td>
                    <td>
                        <a href="' . URL::to('/') . '/admin/slider/del/' . $image['id'] . '"><i class="glyphicon glyphicon-remove"></i> Delete</a>
                    </td>

                </tr>';
        }
        return view('admin.images.slider')->with(['productView' => $productView]);
    }
コード例 #3
0
ファイル: ImagesController.php プロジェクト: dhduc/shopui
    public function index($key)
    {
        $productID = $key;
        $productName = Product::find($key)->name;
        $images = Images::where('productID', $key)->get();
        $productView = "";
        foreach ($images as $image) {
            $productView .= '<tr><td>
                        ' . $image['id'] . '
                    </td>
                    <td>
                        <img src="' . URL::to('/') . '/' . $image['imageSrc'] . '" width="100px" height="100px" />
                    </td>
                    <td>
                        ' . $image['imageName'] . '
                    </td>
                    <td>
                        <a href="' . URL::to('/') . '/admin/images/del/' . $image['id'] . '"><i class="glyphicon glyphicon-remove"></i> Delete</a>
                    </td>

                </tr>';
        }
        return view('admin.images.list')->with(['productID' => $productID, 'productName' => $productName, 'productView' => $productView]);
    }
コード例 #4
0
ファイル: Images.php プロジェクト: timurAbl93/site
 public static function deleteImagesByID($id)
 {
     Images::where('id', '=', $id)->delete();
 }
コード例 #5
0
 public function get_doctor_comments(Request $request, $doc_id)
 {
     try {
         $comments = Comments::where('doctor_id', $doc_id)->orderBy('id', 'DESC')->get();
         $count = 1;
         foreach ($comments as $com) {
             $user = Patients::where('user_id', $com->user_id)->first();
             $img = Images::where('user_id', $com->user_id)->first();
             $temp['comment'] = $com;
             $temp['user'] = $user;
             $temp['user_img'] = $img;
             $comment_ob['comment_' . $count] = $temp;
             $count++;
         }
     } catch (Exception $e) {
         $this->LogError('AjaxController Get_Doctor_Comments Function', $e);
     }
     if ($count > 1) {
         $res['COMMENT'] = "YES";
         $res['DATA'] = $comment_ob;
         return response()->json($res);
     } else {
         $res['COMMENT'] = "NO";
         return response()->json($res);
     }
 }
コード例 #6
0
ファイル: Front.php プロジェクト: Bmax-Tech/SEP-Prototype_MVC
 public function view_profile($doc_name, $doc_id)
 {
     try {
         $doctor = Doctors::find($doc_id);
         $img = Images::where('user_id', $doctor->user_id)->first();
         $main_doc_ob['image_data'] = $img;
         $main_doc_ob['doctor_data'] = $doctor;
         if ($doctor->doc_type == "FORMAL") {
             $main_doc_ob['doc_type'] = "FORMAL";
             $formal = Formal_doctors::where('doctor_id', $doctor->id)->first();
             $main_doc_ob['formal_data'] = $formal;
         } else {
             $main_doc_ob['doc_type'] = "NON_FORMAL";
             $non_formal = Non_Formal_doctors::where('doctor_id', $doctor->id)->first();
             $main_doc_ob['non_formal_data'] = $non_formal;
         }
         $spec = Specialization::where('doc_id', $doctor->id)->first();
         $treat = Treatments::where('doc_id', $doctor->id)->first();
         $main_doc_ob['spec_data'] = $spec;
         $main_doc_ob['treat_data'] = $treat;
     } catch (Exception $e) {
         $this->LogError('View Doctor Profile', $e);
     }
     /* Run Recently Viewed Profiles */
     self::RecentlyViewedProfiles($doc_id);
     /* Add new hit to Profile View hit counter */
     self::ProfileViewHitCounter($doc_id);
     return View::make('profile', array('doctor' => $main_doc_ob));
 }
コード例 #7
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $product = Product::find($id);
     $this->validate($request, ['title' => 'required|max:255', 'description' => 'required', 'price' => 'integer|between:0,30000']);
     $title = Input::get('title');
     $description = Input::get('description');
     $price = Input::get('price');
     $oldPhotos = Input::get('oldPhotos');
     $colors = Input::get('color');
     $categories = Input::get('categories');
     $product->update(['title' => $title, 'description' => $description, 'price' => $price]);
     $images = Input::file('photos');
     $colors = Input::get('color');
     $photos = [];
     $photos_ids = [];
     if ((is_array($images) || is_object($images)) && !($images[0] == null)) {
         for ($i = 0; $i < sizeof($images); $i++) {
             //dd($images);
             $image = $images[$i];
             $color = $colors[$i];
             srand(time());
             $filename = rand() . $i . '.' . $image->getClientOriginalExtension();
             //save image
             Images::create(['color' => $color, 'img' => $filename, 'alt' => '123']);
             $path = storage_path() . '/app/images/' . $filename;
             $im = Image::make($image->getRealPath());
             if ($im->width() > 900) {
                 $im->resize(900, null, function ($c) {
                     $c->aspectRatio();
                     $c->upsize();
                 });
             }
             $im->save($path);
             $p = Images::where('img', $filename)->first();
             array_push($photos, $p);
             array_push($photos_ids, $photos[$i]->id);
         }
     }
     if (isset($categories)) {
         $product->category()->sync($categories);
     }
     if (is_array($oldPhotos) && !is_array($photos_ids)) {
         $allPhotos = $oldPhotos;
         $product->images()->sync($allPhotos);
     }
     if (is_array($photos_ids) && !is_array($oldPhotos)) {
         $allPhotos = $photos_ids;
         $product->images()->sync($allPhotos);
     }
     if (is_array($photos_ids) && is_array($oldPhotos)) {
         $allPhotos = array_merge($photos_ids, $oldPhotos);
         $product->images()->sync($allPhotos);
     }
     return redirect()->back()->with('message', ' პროდუქტი განხლდა');
 }
コード例 #8
0
 public function publicShow($id)
 {
     $trap = Traps::findOrFail($id);
     $images = Images::where('trap_id', $id)->get();
     return view('home.show_trap')->with('trap', $trap)->with('images', $images);
 }
コード例 #9
0
ファイル: CartController.php プロジェクト: dhduc/shopui
    public function allItem($type)
    {
        $allItem = "";
        $total = 0;
        if (Session::has('product')) {
            $products = Session::get('product');
            if (count($products) > 0) {
                foreach ($products as $item) {
                    $images = Images::where('productID', $item["id"])->first();
                    $thumbnail = $images['imageSrc'];
                    if ($type == "view") {
                        $allItem .= '<td class="goods-page-image"><input type="hidden" name="id[]" value="' . $item["id"] . '" />
                            <a href="' . URL::to('/product/') . '/' . $item["id"] . '" target="_blank"><img src="' . URL::to('/') . '/' . $thumbnail . '" alt=""></a>
                            </td>';
                        $allItem .= '<td class="goods-page-description">
                         <h3><a href="' . URL::to('/product/') . '/' . $item["id"] . '" target="_blank">' . $item['name'] . '</a></h3>
                            </td>';
                        $allItem .= '<td class="goods-page-quantity">
                            <div class="product-quantity">
                            <div class="input-group bootstrap-touchspin input-group-sm"><span class="input-group-btn">
                            <button class="btn quantity-down bootstrap-touchspin-down" type="button">
                            <i class="fa fa-angle-down"></i></button></span>
                            <span class="input-group-addon bootstrap-touchspin-prefix" style="display: none;"></span>
                            <input name="number[]" id="product-quantity" type="text" value="' . $item['number'] . '" readonly="" class="form-control input-sm" style="display: block;"><span class="input-group-addon bootstrap-touchspin-postfix" style="display: none;"></span><span class="input-group-btn"><button class="btn quantity-up bootstrap-touchspin-up" type="button"><i class="fa fa-angle-up"></i></button></span></div>
                            </div>
                          </td>';
                        $allItem .= '<td class="goods-page-price">
                            <strong><span>$</span>' . $item['price'] . '</strong>
                            </td>';
                        $allItem .= '<td class="goods-page-total">
                            <strong><span>$</span>' . $item['total'] . '</strong>
                            </td>';
                        $allItem .= '<td class="del-goods-col">
                            <a class="del-goods" href="' . URL::to('/cart/remove') . '/' . $item['id'] . '">&nbsp;</a>
                         </td></tr>';
                    } else {
                        if ($type == "checkout") {
                            $allItem .= '<tr><input type="hidden" name="productID[]" value="' . $item['id'] . '" />
                            <td class="goods-page-image">
                            <a href="' . URL::to('/product/') . '/' . $item['id'] . '" target="_blank"><img src="' . URL::to('/') . '/' . $thumbnail . '" alt=""></a>
                            </td>';
                            $allItem .= '<td class="goods-page-description">
                         <h3><a href="' . URL::to('/product/') . '/' . $item['id'] . '" target="_blank">' . $item['name'] . '</a></h3>
                            </td>';
                            $allItem .= '<td class="goods-page-quantity">
                            <div class="">
                                <h3>' . $item['number'] . '</h3>
                                <input name="pQty[]" id="product-quantity" type="hidden" value="' . $item['number'] . '" readonly class="form-control input-sm" style="display: block;">

                            </div>
                          </td>';
                            $allItem .= '<td class="goods-page-price">
                            <strong><span>$</span>' . $item['price'] . '</strong>
                            </td>';
                            $allItem .= '<td class="goods-page-total">
                            <strong><span>$</span>' . $item['total'] . '</strong>
                            </td></tr>';
                        }
                    }
                    $total += $item['total'];
                }
                $this->total = $total;
            } else {
                return redirect(URL::to('/'))->withSuccess("Shopping cart empty");
            }
        } else {
            return redirect(URL::to('/'))->withSuccess("Shopping cart empty");
        }
        return $allItem;
    }
コード例 #10
0
ファイル: CategoryController.php プロジェクト: dhduc/shopui
 public function allProductInCategory($id = 0, $type = "", $order = "")
 {
     $this->allCategoryId($id);
     if ($type == "all" and $order == "") {
         $products = DB::table('product')->whereIn('category_id', $this->allID)->paginate(9)->toArray();
     } else {
         if ($type == "name" and $order == "asc") {
             $products = DB::table('product')->whereIn('category_id', $this->allID)->orderBy("name", "asc")->paginate(9)->toArray();
         } else {
             if ($type == "name" and $order == "desc") {
                 $products = DB::table('product')->whereIn('category_id', $this->allID)->orderBy("name", "desc")->paginate(9)->toArray();
             } else {
                 if ($type == "price" and $order == "asc") {
                     $products = DB::table('product')->whereIn('category_id', $this->allID)->orderBy("price", "asc")->paginate(9)->toArray();
                 } else {
                     if ($type == "price" and $order == "desc") {
                         $products = DB::table('product')->whereIn('category_id', $this->allID)->orderBy("price", "desc")->paginate(9)->toArray();
                     }
                 }
             }
         }
     }
     $allProduct = array();
     foreach ($products['data'] as $product) {
         $allProduct[] = $product;
     }
     $allProductInView = "";
     foreach ($allProduct as $item) {
         $description = $item->description;
         $producerName = Producer::find($item->producer)->producer;
         $images = Images::where('productID', $item->id)->first();
         $thumbnail = $images['imageSrc'];
         $allProductInView .= '<div class="col-md-4 col-sm-6 col-xs-12">';
         $allProductInView .= '<div class="thumbnail">';
         $allProductInView .= '<a class="preview" rel="' . URL::to('/') . '/' . $thumbnail . '" href="' . URL::to('/product') . '/' . $item->id . '/' . $item->name . '.html" class="post-image-link">';
         $allProductInView .= '<p><img src="' . URL::to('/') . '/' . $thumbnail . '" class="img-responsive" alt="' . strtolower($item->name) . '"></p>';
         $allProductInView .= '</a>';
         $allProductInView .= '<div class="caption">';
         $allProductInView .= '<h3><a href="' . URL::to('/product') . '/' . $item->id . '/' . strtolower($item->name) . '.html">' . $item->name . '</a></h3>';
         $allProductInView .= substr($description, 0, 70) . '<br>';
         $allProductInView .= '<span class="btn btn-default"><i class="fa fa-cart"></i>' . $item->price . '$</span>';
         $allProductInView .= '<a href="' . URL::to('/') . '/producer/' . $item->producer . '" class="btn btn-primary">' . $producerName . '</a>';
         $allProductInView .= '</div>';
         $allProductInView .= ' </div></div>';
     }
     return $allProductInView;
 }
コード例 #11
0
ファイル: HomeController.php プロジェクト: dhduc/shopui
 public function allProducts($type = "", $id = 0, $search = "")
 {
     if ($type == "new") {
         $products = DB::table('product')->orderBy('id', 'desc')->paginate(4)->toArray();
     } else {
         if ($type == "best_seller") {
             $products = DB::table('product')->orderBy('purchase', 'desc')->paginate(4)->toArray();
         } else {
             if ($type == 'search') {
                 $products = DB::table('product')->where('name', 'LIKE', '%' . $search . '%')->paginate(8)->toArray();
             }
         }
     }
     $allProduct = array();
     foreach ($products['data'] as $product) {
         $allProduct[] = $product;
     }
     $allProductInView = "";
     foreach ($allProduct as $item) {
         $description = $item->description;
         $producerName = Producer::find($item->producer)->producer;
         $images = Images::where('productID', $item->id)->first();
         $thumbnail = $images['imageSrc'];
         $allProductInView .= '<div class="col-lg-3 col-sm-6">';
         $allProductInView .= '<div class="thumbnail">';
         $allProductInView .= '<a class="preview" rel="' . URL::to('/') . '/' . $thumbnail . '" href="' . URL::to('/product') . '/' . $item->id . '/' . $item->name . '.html" class="post-image-link">';
         $allProductInView .= '<p><img src="' . URL::to('/') . '/' . $thumbnail . '" class="img-responsive" alt="' . strtolower($item->name) . '"></p>';
         $allProductInView .= '</a>';
         $allProductInView .= '<div class="caption">';
         $allProductInView .= '<h3><a href="' . URL::to('/product') . '/' . $item->id . '/' . strtolower($item->name) . '.html">' . $item->name . '</a></h3>';
         $allProductInView .= substr($description, 0, 70) . '<br>';
         $allProductInView .= '<span class="btn btn-default"><i class="fa fa-cart"></i>' . $item->price . '$</span>';
         $allProductInView .= '<a href="' . URL::to('/') . '/producer/' . $item->producer . '/' . strtolower($producerName) . '.html" class="btn btn-primary">' . $producerName . '</a>';
         $allProductInView .= '</div>';
         $allProductInView .= ' </div></div>';
     }
     return $allProductInView;
 }
コード例 #12
0
 public function deleteImage(Request $request)
 {
     if (Auth::user()->email == '*****@*****.**') {
         Images::where('id', $request->input('image_id'))->delete();
         return redirect()->back()->with($request->session()->flash('admin-success', 'Успешно изтрихте снимка.'));
     }
 }
コード例 #13
0
ファイル: ProductController.php プロジェクト: dhduc/shopui
 public function setThumbnail()
 {
     $products = Product::all()->toArray();
     foreach ($products as $item) {
         $images = Images::where('productID', $item['id'])->first();
         $thumbnail = $images['imageSrc'];
         $model = Product::find($item['id']);
         $model->thumbnail = $thumbnail;
         $model->save();
     }
     return redirect_success('Admin\\ProductController@index', "Set Thumbnail Success");
 }