/**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     //
     $order = Order::find($id);
     $order_detail = Order_detail::where('order_id', $id)->get();
     $product = Product::all();
     $color = Color::all();
     $size = Size::all();
     return view('backend.pages.order.detail', array('order' => $order, 'detail' => $order_detail, 'product' => $product, 'color' => $color, 'size' => $size));
 }
 public function products()
 {
     if (!\Session::get('user')->can('产品查看')) {
         abort(401);
     }
     return view('products/index', ['products' => Product::all()]);
 }
Example #3
0
 public function productList()
 {
     $message = \Session::get('message');
     $list = \App\Product::all();
     $dimensions = Arrays::dimensionNames();
     return view('admin.list', compact('list', 'dimensions', 'message'));
 }
Example #4
0
 public function index()
 {
     $products = Product::all();
     $productCode = Product::limit(1)->orderBy('product_code', 'decs')->first();
     if (isset($productCode->product_code)) {
         $crop = substr($productCode->product_code, 4);
         if ($crop < 9) {
             $plus = $crop + 1;
             $urutan = "JOR000" . $plus;
         } elseif ($crop < 99) {
             $plus = $crop + 1;
             $urutan = "JOR00" . $plus;
         } elseif ($crop < 999) {
             $plus = $crop + 1;
             $urutan = "JOR0" . $plus;
         } elseif ($crop < 9999) {
             $plus = $crop + 1;
             $urutan = "JOR" . $plus;
         } elseif ($crop >= 9999) {
             $urutan = "ERROR";
         }
     } else {
         $urutan = "JOR0001";
     }
     // return response()->json(array('data' => $products, 'urutan' => $urutan));
     return view('admin.product')->withProducts($products)->withUrutans($urutan);
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $products = Product::all();
     /*return view('products.index')
       ->with('products', $products);*/
     return $products;
 }
Example #6
0
 public function index()
 {
     $products = Product::all();
     $users = User::all();
     return view('admin.admin')->with(['users' => $users, 'products' => $products]);
     //return view('admin.test');
 }
Example #7
0
 /**
  * Dashboard Details
  *
  *
  */
 public function dashboard()
 {
     $products = Product::all()->count();
     $orders = Order::all()->count();
     $users = User::all()->count();
     return view('admin.dashboard', compact('products', 'orders', 'users'));
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $statuses = Status::all();
     $products = Product::all();
     $productionschedule = Batch::find($id);
     return view('production.edit', ['productionschedule' => $productionschedule, 'products' => $products, 'statuses' => $statuses]);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $employee_ids = Employee::all()->lists('id')->toArray();
     $order_states = OrderState::lists('id')->toArray();
     $products = Product::all();
     $municipalities = Municipality::all();
     factory(App\Customer::class, 50)->create()->each(function ($customer) use($employee_ids, $products, $municipalities, $order_states) {
         shuffle($employee_ids);
         shuffle($order_states);
         $customer->user()->save(factory(User::class, 'customer')->create());
         $customer->city_id = $municipalities->shuffle()->first()->id;
         $customer->save();
         $customer->products()->attach($products->shuffle()->first(), ['vote' => rand(1, 5), 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()]);
         $customer->orders()->save(factory(App\Order::class)->create(['acquired_by' => $employee_ids[0], 'state_id' => $order_states[0]]));
     });
     $user = new User();
     $user->name = 'Vid';
     $user->surname = 'Mahovic';
     $user->email = '*****@*****.**';
     $user->password = '******';
     $user->verified = true;
     $user->save();
     $customer = new Customer();
     $customer->street = 'Celovška 21';
     $customer->city_id = $municipalities->shuffle()->first()->id;
     $customer->phone = '+38640850993';
     $customer->save();
     $customer->user()->save($user);
 }
Example #10
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $products = Product::all();
     $countInactive = 0;
     $countDeleted = 0;
     $arrProductsIna = [];
     $arrProductsDel = [];
     foreach ($products as $product) {
         $differenceDays = $product->created_at->diffInDays(Carbon::now());
         if ($differenceDays >= 30 && $product->published != 0) {
             $product->published = 0;
             $product->save();
             $countInactive++;
             $arrProductsIna[] = $product->name;
         }
         /*if($differenceDays >= 60 && $product->published == 0)
           {
               $arrProductsDel[]= $product->name;
               $this->productRepository->destroy($product->id);
               $countDeleted++;
           }*/
     }
     $this->info('Done, ' . $countInactive . ' Inactive Products - ' . $countDeleted . ' Delete Products');
     try {
         $this->mailer->infoProductsInnactive(['productsIna' => $arrProductsIna, 'productsDel' => $arrProductsDel, 'innactives' => $countInactive, 'deleted' => $countDeleted]);
     } catch (Swift_RfcComplianceException $e) {
         Log::error($e->getMessage());
     }
 }
 /**
  * Index page
  *
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function index()
 {
     $productsCount = Product::all()->count();
     $categoriesCount = Category::all()->count();
     $usersCount = User::all()->count();
     return view('manage.index', compact('productsCount', 'categoriesCount', 'usersCount'));
 }
 public function index()
 {
     $products = \App\Product::all();
     // $products = \App\Product::where('price','<','10.00')->get();
     $mostPopularProducts = [];
     return view('products', compact('products', 'mostPopularProducts'));
 }
Example #13
0
 public function home()
 {
     $products = Product::all();
     $categories = Categorie::all();
     //dump($products);
     return view('accueil', ["produit" => $products, "category" => $categories]);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     // Suppression préalable des fichiers de upload par l'utilisation de la variable storage définie à l'aide de l'instruction public_path('upload') du fichier de configuration config\filesystem.php)
     $files = Storage::allFiles();
     //retroune un tableau des images de storage
     foreach ($files as $file) {
         Storage::delete($file);
     }
     //Supprimer toutes les lignes de la talble Pictures
     //        DB::table('pictures')->
     // Récupération d'un faker opétationnel
     // $faker = Faker\Factory::create();
     $products = Product::all();
     foreach ($products as $product) {
         // Stokage de l'image et récupération de l'uri
         $uri = str_random(15) . '_370x235.jpg';
         Storage::put($uri, file_get_contents('http://lorempixel.com/people/370/325/'));
         Picture::create(['product_id' => $product->id, 'uri' => $uri, 'title' => $this->faker->name]);
     }
     //        DB::table('pictures')->insert(
     //            [
     //                [
     //                    'product_id'  => '2' ,
     //                    'uri'         => $uri
     //                ],
     //            ]
     //        );
 }
 public function index(Request $request, $productId = 0)
 {
     $product = Product::find($productId);
     $initTime = microtime(true);
     $products = Product::all();
     $finalTime = microtime(true);
     return view('customer.product', ['products' => $products, 'product' => $product, 'executionTime' => $finalTime - $initTime]);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $product = new Product();
     $product->name = Input::get('name');
     $product->description = Input::get('description');
     $product->save();
     return view('products.index', ['products' => Product::all()]);
 }
Example #17
0
 public function showProducts()
 {
     $products = Product::all();
     $food = Category::food()->get();
     $drinks = Category::drinks()->get();
     $other = Category::other()->get();
     return view('admin.products', compact('products', 'food', 'drinks', 'other'));
 }
Example #18
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $products = Product::all();
     foreach ($products as $p) {
         $p->slug = Str::slug($p->name);
         $p->save();
     }
 }
 public function getIndex()
 {
     $categories = array();
     foreach (Category::all() as $category) {
         $categories[$category->id] = $category->name;
     }
     return View::make('products.index')->with('products', Product::all())->with('categories', $categories);
 }
Example #20
0
 public function index()
 {
     $products = Product::all();
     //Con este pruebo si se conecta a la base
     //dd($products);
     //Hago el return a routes
     return view('store.index', compact('products'));
 }
Example #21
0
 /**
  * Display the specified resource.
  *
  * @param  Product $product // Route model binding
  * @return Response
  */
 public function show(Product $product)
 {
     $products = Product::all();
     $other_list = $product->other_list;
     $other_list_objs = array_filter(json_decode($other_list, true));
     $standard_features = $product->standard_features;
     $objstandard_features = array_filter(json_decode($standard_features, true));
     return view('products.show', compact('product'), ['products' => $products, 'other_list_objs' => $other_list_objs, 'objstandard_features' => $objstandard_features]);
 }
Example #22
0
 /**
  * Display a listing of the resource.
  * HTTP method: GET
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     if (auth()->user()->hasRole('employee')) {
         $products = Product::withTrashed()->all();
     } else {
         $products = Product::all();
     }
     return view('list_products')->with(['products' => $products]);
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index($id = null)
 {
     if ($id == null) {
         $products = Product::all();
     } else {
         $products = Product::find($id);
     }
     return $products;
 }
 public function getIndex()
 {
     $objects = Product::all();
     $categories = array();
     foreach (Product::all() as $product) {
         $categories[$product->id] = Category::find($product->category_id)->name;
     }
     return view('admin/products/index')->with('objects', $objects)->with('category', $categories);
 }
Example #25
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $products = Product::all();
     $categories = array();
     foreach (Category::all() as $category) {
         $categories[$category->id] = $category->name;
     }
     return view('products\\index')->with('products', $products)->with('categories', $categories);
 }
Example #26
0
 private function getProductsAsArray()
 {
     $products = Product::all();
     $arr = [];
     foreach ($products as $product) {
         $arr[] = $product;
     }
     return $arr;
 }
Example #27
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $brands = new Brand();
     $brands = Brand::all();
     $category = new Category();
     $categorys = Category::all();
     $products = new Product();
     $products = Product::all();
     return view('home', ['categorys' => $categorys, 'brands' => $brands, 'products' => $products]);
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     $key = $request->input('key');
     if ($key) {
         $products = Product::where('title', 'like', '%' . $key . '%')->orWhere('place', 'like', '%' . $key . '%')->get();
     } else {
         $products = Product::all();
     }
     return view('admin.product.index', compact('key', 'products'));
 }
Example #29
0
 public function search()
 {
     $products = Product::all();
     $doctors = Customer::all();
     $MRs = Employee::where('level_id', 7)->get();
     $AMs = Employee::where('level_id', 3)->get();
     $SMs = Employee::where('level_id', 2)->get();
     $dataView = ['products' => $products, 'doctors' => $doctors, 'MRs' => $MRs, 'AMs' => $AMs, 'SMs' => $SMs];
     return view('admin.search.sales.search', $dataView);
 }
Example #30
0
 public static function boot()
 {
     parent::boot();
     static::created(function ($model) {
         $products = Product::all();
         foreach ($products as $product) {
             $model->stocks()->create(['product_id' => $product->id, 'qty' => 0]);
         }
     });
 }