From 38113a3625a8a7ffbc2b644b13bfb5af5c51c699 Mon Sep 17 00:00:00 2001 From: Josemprog Date: Tue, 17 Nov 2020 15:42:21 -0500 Subject: [PATCH] build: DOMPFD was installed. --- .gitignore | 1 + .../Controllers/Admin/ProductController.php | 19 +- app/Http/Controllers/Admin/UserController.php | 1 - app/Http/Controllers/CartController.php | 1 - app/Http/Controllers/HomeController.php | 36 +-- app/Http/Controllers/OrderController.php | 7 - .../Controllers/ProductCartController.php | 2 - app/Services/CartService.php | 72 ++--- app/Services/PlaceToPayService.php | 135 +++++---- composer.json | 1 + composer.lock | 274 +++++++++++++++++- public/css/app.css | 4 +- resources/sass/_styles.scss | 4 +- .../views/admin/products/index.blade.php | 238 ++++++--------- .../views/admin/products/panel.blade.php | 195 ++++++------- routes/web.php | 9 +- 16 files changed, 606 insertions(+), 393 deletions(-) diff --git a/.gitignore b/.gitignore index 9c50ae7..3cb74ec 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ Homestead.json Homestead.yaml npm-debug.log yarn-error.log +.vscode diff --git a/app/Http/Controllers/Admin/ProductController.php b/app/Http/Controllers/Admin/ProductController.php index 285ecb7..791833d 100644 --- a/app/Http/Controllers/Admin/ProductController.php +++ b/app/Http/Controllers/Admin/ProductController.php @@ -72,8 +72,7 @@ public function store(ProductsRequest $request): \Illuminate\Http\RedirectRespon $product = new Product($request->validated()); $product->image = $request->file('image')->store('images', 'public'); $product->save(); - - // Optimizing the image + $image = Image::make(storage_path('app/public/' . $product->image)); $image->widen(600)->limitColors(255, '#ff9900')->encode(); Storage::put($product->image, (string) $image); @@ -114,23 +113,19 @@ public function edit(Product $product): \Illuminate\View\View */ public function update(Product $product, ProductsRequest $request): \Illuminate\Http\RedirectResponse { - - if ($request->hasFile('image')) { - - Storage::disk('public')->delete($product->image); Storage::delete($product->image); - + $product->fill($request->validated()); $product->image = $request->file('image')->store('images', 'public'); $product->save(); $image = Image::make(storage_path('app/public/' . $product->image)); $image->widen(600)->limitColors(255, '#ff9900')->encode(); + Storage::put($product->image, (string) $image); } else { - $product->update($request->validated()); } @@ -147,7 +142,6 @@ public function update(Product $product, ProductsRequest $request): \Illuminate\ */ public function destroy(Product $product): \Illuminate\Http\RedirectResponse { - Storage::disk('public')->delete($product->image); Storage::delete($product->image); @@ -158,7 +152,12 @@ public function destroy(Product $product): \Illuminate\Http\RedirectResponse ->with('message', 'Product Removed'); } - public function export() + /** + * Export all products + * + * @return \Illuminate\Http\RedirectResponse + */ + public function export():\Illuminate\Http\RedirectResponse { (new ProductsExport())->store('products.csv'); return back()->with('message', 'Export started!'); diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index d351534..6a4ce6d 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -75,7 +75,6 @@ public function edit(User $user): \Illuminate\View\View */ public function update(User $user, SaveUsers $request): \Illuminate\Http\RedirectResponse { - $user->update($request->validated()); return redirect() diff --git a/app/Http/Controllers/CartController.php b/app/Http/Controllers/CartController.php index b432419..78780a4 100644 --- a/app/Http/Controllers/CartController.php +++ b/app/Http/Controllers/CartController.php @@ -6,7 +6,6 @@ class CartController extends Controller { - public $cartService; public function __construct(CartService $cartService) diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index f482260..1aee13a 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -6,23 +6,23 @@ class HomeController extends Controller { - /** - * Create a new controller instance. - * - * @return void - */ - public function __construct() - { - $this->middleware('auth'); - } + /** + * Create a new controller instance. + * + * @return void + */ + public function __construct() + { + $this->middleware('auth'); + } - /** - * Show the application dashboard. - * - * @return \Illuminate\Contracts\Support\Renderable - */ - public function index(): \Illuminate\View\View - { - return view('home'); - } + /** + * Show the application dashboard. + * + * @return \Illuminate\Contracts\Support\Renderable + */ + public function index(): \Illuminate\View\View + { + return view('home'); + } } diff --git a/app/Http/Controllers/OrderController.php b/app/Http/Controllers/OrderController.php index 139e694..6b52865 100644 --- a/app/Http/Controllers/OrderController.php +++ b/app/Http/Controllers/OrderController.php @@ -10,7 +10,6 @@ class OrderController extends Controller { - public $cartService; public $p2p; @@ -61,14 +60,11 @@ public function create(): \Illuminate\View\View */ public function show(Order $order): \Illuminate\View\View { - $payment = $this->p2p->getInformation($order->requestId); if ($order->status == 'PENDING') { - $order->status = $payment['status']['status']; $order->save(); - } @@ -94,8 +90,6 @@ public function store(Request $request): \Illuminate\Http\RedirectResponse ->back() ->withErrors("Your cart is empty"); } else { - - $user = $request->user(); if (!isset($order) || $user->orders->isEmpty()) { @@ -135,7 +129,6 @@ public function store(Request $request): \Illuminate\Http\RedirectResponse */ public function retry(Request $request, Order $order): \Illuminate\Http\RedirectResponse { - $payment = $this->p2p->createRequest($order, $request); $order->processUrl = $payment['processUrl']; diff --git a/app/Http/Controllers/ProductCartController.php b/app/Http/Controllers/ProductCartController.php index 89294ae..caf19d4 100644 --- a/app/Http/Controllers/ProductCartController.php +++ b/app/Http/Controllers/ProductCartController.php @@ -55,12 +55,10 @@ public function removeOne(Product $product, Cart $cart): \Illuminate\Http\Redire ->quantity ?? 0; if ($quantity <= 1) { - $cart->products()->detach($product->id); return redirect()->back(); } else { - $cart->products()->syncWithoutDetaching([ $product->id => ['quantity' => $quantity - 1], ]); diff --git a/app/Services/CartService.php b/app/Services/CartService.php index ca578b2..33bd310 100644 --- a/app/Services/CartService.php +++ b/app/Services/CartService.php @@ -6,41 +6,41 @@ class CartService { - /** - * returns the user's first cart - * - * @return void - */ - public function getCartFromUser() - { - return Auth::user()->cart()->first(); - } - - - /** - * The user's cart is selected or a new cart is created for the user - * - * @return void - */ - public function getFromUserOrCreate() - { - $cart = $this->getCartFromUser(); - - return $cart ?? Auth::user()->cart()->create(); - } - - /** - * the products in the cart are counted - * - * @return void - */ - public function countProductsInCart() - { - $cart = $this->getCartFromUser(); - - if ($cart != null) { - return $cart->products->pluck('pivot.quantity')->sum(); + /** + * returns the user's first cart + * + * @return void + */ + public function getCartFromUser() + { + return Auth::user()->cart()->first(); + } + + + /** + * The user's cart is selected or a new cart is created for the user + * + * @return void + */ + public function getFromUserOrCreate() + { + $cart = $this->getCartFromUser(); + + return $cart ?? Auth::user()->cart()->create(); + } + + /** + * the products in the cart are counted + * + * @return void + */ + public function countProductsInCart() + { + $cart = $this->getCartFromUser(); + + if ($cart != null) { + return $cart->products->pluck('pivot.quantity')->sum(); + } + return 0; } - return 0; - } } diff --git a/app/Services/PlaceToPayService.php b/app/Services/PlaceToPayService.php index 2fec0bf..a9a7fef 100644 --- a/app/Services/PlaceToPayService.php +++ b/app/Services/PlaceToPayService.php @@ -8,33 +8,32 @@ class PlaceToPayService { - public const P2P_APPROVED = 'approved'; public const P2P_REJECTED = 'rejected'; public const P2P_PENDING = 'pending'; public const P2P_IN_PROCESS = 'in_process'; - protected $endponitBase; - protected $login; - protected $secretKey; - - public function __construct() - { - $this->endponitBase = config('services.p2p.endpoint_base'); - $this->login = config('services.p2p.login'); - $this->secretKey = config('services.p2p.secret_key'); - } + protected $endponitBase; + protected $login; + protected $secretKey; + + public function __construct() + { + $this->endponitBase = config('services.p2p.endpoint_base'); + $this->login = config('services.p2p.login'); + $this->secretKey = config('services.p2p.secret_key'); + } - /** - * The place to pay api is consumed - * - * @param Order $order - * @param Request $request - * @return void - */ - public function createRequest(Order $order, Request $request) - { - $response = Http::post($this->endponitBase . '/api/session/', [ + /** + * The place to pay api is consumed + * + * @param Order $order + * @param Request $request + * @return void + */ + public function createRequest(Order $order, Request $request) + { + $response = Http::post($this->endponitBase . '/api/session/', [ 'auth' => $this->getCredentials(), 'payment' => [ 'reference' => $order->id, @@ -50,17 +49,17 @@ public function createRequest(Order $order, Request $request) 'userAgent' => request()->userAgent(), ]); - return $response->json(); - } + return $response->json(); + } - /** - * test function to consume place to pay api - * - * @return void - */ - public function createRequestt() - { - $response = Http::post($this->endponitBase . '/api/session/', [ + /** + * test function to consume place to pay api + * + * @return void + */ + public function createRequestt() + { + $response = Http::post($this->endponitBase . '/api/session/', [ 'auth' => $this->getCredentials(), 'payment' => [ 'reference' => '2020sep080704', @@ -76,52 +75,52 @@ public function createRequestt() 'userAgent' => 'PlacetoPay Sandbox', ]); - return $response->json(); - } + return $response->json(); + } - /** - * The requestId information is obtained - * - * @param int $requestId - * @return void - */ - public function getInformation($requestId) - { - $response = Http::post('https://test.placetopay.com/redirection/api/session/' . $requestId, [ + /** + * The requestId information is obtained + * + * @param int $requestId + * @return void + */ + public function getInformation($requestId) + { + $response = Http::post('https://test.placetopay.com/redirection/api/session/' . $requestId, [ 'auth' => $this->getCredentials(), ]); - return $response->json(); - } - - /** - * the credentials requested by the place to pay api are obtained - * - * @return void - */ - public function getCredentials() - { - $login = $this->login; - $secretKey = $this->secretKey; - $seed = date('c'); - - if (function_exists('random_bytes')) { - $nonce = bin2hex(random_bytes(16)); - } elseif (function_exists('openssl_random_pseudo_bytes')) { - $nonce = bin2hex(openssl_random_pseudo_bytes(16)); - } else { - $nonce = mt_rand(); + return $response->json(); } - $nonceBase64 = base64_encode($nonce); - - $tranKey = base64_encode(sha1($nonce . $seed . $secretKey, true)); - - return [ + /** + * the credentials requested by the place to pay api are obtained + * + * @return void + */ + public function getCredentials() + { + $login = $this->login; + $secretKey = $this->secretKey; + $seed = date('c'); + + if (function_exists('random_bytes')) { + $nonce = bin2hex(random_bytes(16)); + } elseif (function_exists('openssl_random_pseudo_bytes')) { + $nonce = bin2hex(openssl_random_pseudo_bytes(16)); + } else { + $nonce = mt_rand(); + } + + $nonceBase64 = base64_encode($nonce); + + $tranKey = base64_encode(sha1($nonce . $seed . $secretKey, true)); + + return [ 'login' => $login, 'seed' => $seed, 'nonce' => $nonceBase64, 'tranKey' => $tranKey, ]; - } + } } diff --git a/composer.json b/composer.json index 10f96a2..1355232 100644 --- a/composer.json +++ b/composer.json @@ -9,6 +9,7 @@ "license": "MIT", "require": { "php": "^7.2.5", + "barryvdh/laravel-dompdf": "^0.8.7", "fideloper/proxy": "^4.2", "fruitcake/laravel-cors": "^2.0", "guzzlehttp/guzzle": "^6.3", diff --git a/composer.lock b/composer.lock index 7c22307..8c72cea 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "92431b88fb489a5090b33837888f76c2", + "content-hash": "6529974bc76f0d93e303b2855dfb3697", "packages": [ { "name": "asm89/stack-cors", @@ -62,6 +62,72 @@ }, "time": "2020-10-29T16:03:21+00:00" }, + { + "name": "barryvdh/laravel-dompdf", + "version": "v0.8.7", + "source": { + "type": "git", + "url": "https://github.com/barryvdh/laravel-dompdf.git", + "reference": "30310e0a675462bf2aa9d448c8dcbf57fbcc517d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/barryvdh/laravel-dompdf/zipball/30310e0a675462bf2aa9d448c8dcbf57fbcc517d", + "reference": "30310e0a675462bf2aa9d448c8dcbf57fbcc517d", + "shasum": "" + }, + "require": { + "dompdf/dompdf": "^0.8", + "illuminate/support": "^5.5|^6|^7|^8", + "php": ">=7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.8-dev" + }, + "laravel": { + "providers": [ + "Barryvdh\\DomPDF\\ServiceProvider" + ], + "aliases": { + "PDF": "Barryvdh\\DomPDF\\Facade" + } + } + }, + "autoload": { + "psr-4": { + "Barryvdh\\DomPDF\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Barry vd. Heuvel", + "email": "barryvdh@gmail.com" + } + ], + "description": "A DOMPDF Wrapper for Laravel", + "keywords": [ + "dompdf", + "laravel", + "pdf" + ], + "support": { + "issues": "https://github.com/barryvdh/laravel-dompdf/issues", + "source": "https://github.com/barryvdh/laravel-dompdf/tree/master" + }, + "funding": [ + { + "url": "https://github.com/barryvdh", + "type": "github" + } + ], + "time": "2020-09-07T11:50:18+00:00" + }, { "name": "brick/math", "version": "0.9.1", @@ -330,6 +396,78 @@ ], "time": "2020-05-25T17:44:05+00:00" }, + { + "name": "dompdf/dompdf", + "version": "v0.8.6", + "source": { + "type": "git", + "url": "https://github.com/dompdf/dompdf.git", + "reference": "db91d81866c69a42dad1d2926f61515a1e3f42c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dompdf/dompdf/zipball/db91d81866c69a42dad1d2926f61515a1e3f42c5", + "reference": "db91d81866c69a42dad1d2926f61515a1e3f42c5", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-mbstring": "*", + "phenx/php-font-lib": "^0.5.2", + "phenx/php-svg-lib": "^0.3.3", + "php": "^7.1" + }, + "require-dev": { + "mockery/mockery": "^1.3", + "phpunit/phpunit": "^7.5", + "squizlabs/php_codesniffer": "^3.5" + }, + "suggest": { + "ext-gd": "Needed to process images", + "ext-gmagick": "Improves image processing performance", + "ext-imagick": "Improves image processing performance", + "ext-zlib": "Needed for pdf stream compression" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-develop": "0.7-dev" + } + }, + "autoload": { + "psr-4": { + "Dompdf\\": "src/" + }, + "classmap": [ + "lib/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-2.1" + ], + "authors": [ + { + "name": "Fabien Ménager", + "email": "fabien.menager@gmail.com" + }, + { + "name": "Brian Sweeney", + "email": "eclecticgeek@gmail.com" + }, + { + "name": "Gabriel Bull", + "email": "me@gabrielbull.com" + } + ], + "description": "DOMPDF is a CSS 2.1 compliant HTML to PDF converter", + "homepage": "https://github.com/dompdf/dompdf", + "support": { + "issues": "https://github.com/dompdf/dompdf/issues", + "source": "https://github.com/dompdf/dompdf/tree/master" + }, + "time": "2020-08-30T22:54:22+00:00" + }, { "name": "dragonmantank/cron-expression", "version": "v2.3.1", @@ -2083,6 +2221,91 @@ }, "time": "2020-11-07T02:01:34+00:00" }, + { + "name": "phenx/php-font-lib", + "version": "0.5.2", + "source": { + "type": "git", + "url": "https://github.com/PhenX/php-font-lib.git", + "reference": "ca6ad461f032145fff5971b5985e5af9e7fa88d8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PhenX/php-font-lib/zipball/ca6ad461f032145fff5971b5985e5af9e7fa88d8", + "reference": "ca6ad461f032145fff5971b5985e5af9e7fa88d8", + "shasum": "" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5 || ^6 || ^7" + }, + "type": "library", + "autoload": { + "psr-4": { + "FontLib\\": "src/FontLib" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0" + ], + "authors": [ + { + "name": "Fabien Ménager", + "email": "fabien.menager@gmail.com" + } + ], + "description": "A library to read, parse, export and make subsets of different types of font files.", + "homepage": "https://github.com/PhenX/php-font-lib", + "support": { + "issues": "https://github.com/PhenX/php-font-lib/issues", + "source": "https://github.com/PhenX/php-font-lib/tree/0.5.2" + }, + "time": "2020-03-08T15:31:32+00:00" + }, + { + "name": "phenx/php-svg-lib", + "version": "v0.3.3", + "source": { + "type": "git", + "url": "https://github.com/PhenX/php-svg-lib.git", + "reference": "5fa61b65e612ce1ae15f69b3d223cb14ecc60e32" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PhenX/php-svg-lib/zipball/5fa61b65e612ce1ae15f69b3d223cb14ecc60e32", + "reference": "5fa61b65e612ce1ae15f69b3d223cb14ecc60e32", + "shasum": "" + }, + "require": { + "sabberworm/php-css-parser": "^8.3" + }, + "require-dev": { + "phpunit/phpunit": "^5.5|^6.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Svg\\": "src/Svg" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0" + ], + "authors": [ + { + "name": "Fabien Ménager", + "email": "fabien.menager@gmail.com" + } + ], + "description": "A library to read, parse and export to PDF SVG files.", + "homepage": "https://github.com/PhenX/php-svg-lib", + "support": { + "issues": "https://github.com/PhenX/php-svg-lib/issues", + "source": "https://github.com/PhenX/php-svg-lib/tree/master" + }, + "time": "2019-09-11T20:02:13+00:00" + }, { "name": "phpoffice/phpspreadsheet", "version": "1.15.0", @@ -2980,6 +3203,55 @@ ], "time": "2020-08-18T17:17:46+00:00" }, + { + "name": "sabberworm/php-css-parser", + "version": "8.3.1", + "source": { + "type": "git", + "url": "https://github.com/sabberworm/PHP-CSS-Parser.git", + "reference": "d217848e1396ef962fb1997cf3e2421acba7f796" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sabberworm/PHP-CSS-Parser/zipball/d217848e1396ef962fb1997cf3e2421acba7f796", + "reference": "d217848e1396ef962fb1997cf3e2421acba7f796", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "codacy/coverage": "^1.4", + "phpunit/phpunit": "~4.8" + }, + "type": "library", + "autoload": { + "psr-0": { + "Sabberworm\\CSS": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Raphael Schweikert" + } + ], + "description": "Parser for CSS Files written in PHP", + "homepage": "http://www.sabberworm.com/blog/2010/6/10/php-css-parser", + "keywords": [ + "css", + "parser", + "stylesheet" + ], + "support": { + "issues": "https://github.com/sabberworm/PHP-CSS-Parser/issues", + "source": "https://github.com/sabberworm/PHP-CSS-Parser/tree/8.3.1" + }, + "time": "2020-06-01T09:10:00+00:00" + }, { "name": "swiftmailer/swiftmailer", "version": "v6.2.3", diff --git a/public/css/app.css b/public/css/app.css index 722a038..42db18e 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -48,7 +48,7 @@ .main-container { display: grid; - grid-template-columns: 16% 84%; + grid-template-columns: 18% 82%; } .container-filter { @@ -77,7 +77,7 @@ body { border-radius: 5px; width: 190px; height: 250px; - margin: 0 10px 20px 10px; + margin: 0 7px 20px 7px; background: rgba(255, 255, 255, 0.693); } diff --git a/resources/sass/_styles.scss b/resources/sass/_styles.scss index f056927..b7543ba 100644 --- a/resources/sass/_styles.scss +++ b/resources/sass/_styles.scss @@ -41,7 +41,7 @@ .main-container { display: grid; - grid-template-columns: 16% 84%; + grid-template-columns: 18% 82%; } .container-filter { @@ -71,7 +71,7 @@ body { border-radius: 5px; width: 190px; height: 250px; - margin: 0 10px 20px 10px; + margin: 0 7px 20px 7px; background: rgba(255, 255, 255, 0.693); } diff --git a/resources/views/admin/products/index.blade.php b/resources/views/admin/products/index.blade.php index 089b60d..4cbce60 100644 --- a/resources/views/admin/products/index.blade.php +++ b/resources/views/admin/products/index.blade.php @@ -3,167 +3,115 @@ @section('content')
-
-
- {{-- Administrator menu --}} - @auth - @if (Auth::user()->admin or Auth::user()->main_admin) - {{-- buttons --}} -
- + Create a new Product - View admin panel - Manage Users -
- @endif - @endauth +
+
+ {{-- Administrator menu --}} + @auth + @if (Auth::user()->admin or Auth::user()->main_admin) + {{-- buttons --}} + + @endif + @endauth - {{-- Filter form --}} -
- @csrf -

Filter

- Search by Brand - + {{-- Filter form --}} + + @csrf +

Filter

+ Search by Brand + - Search by name - + Search by name + - Search by price - + Search by price + - -
+ + +
-
- {{-- Products container --}} -
+ {{-- Products container --}} +
-
- @forelse ($products as $product) - @if ($product->enabled == 1) +
+ @forelse ($products as $product) + @if ($product->enabled == 1) - {{------------------------- Card Products -------------------------}} -
-
- {{------------------------- Brand Product -------------------------}} -

{{$product->brand}}

+ {{------------------------- Card Products -------------------------}} +
+
+ {{------------------------- Brand Product -------------------------}} +

{{$product->brand}}

- {{---------------------- Admin buttons--------------------------}} - @auth - @if (Auth::user()->admin or Auth::user()->main_admin) -
- - - -
- @csrf - @method('DELETE') - -
-
- @endif - @endauth -
- {{---------------------- Product image--------------------------}} -
- @if (substr($product->image, 0, 5) == 'https') - Responsive image - @else - Responsive image - @endif -
-
- {{---------------------- Name and price of product--------------------------}} -
-
{{ $product->name}}
- ${{ number_format($product->price)}} -
+ {{---------------------- Admin buttons--------------------------}} + @auth + @if (Auth::user()->admin or Auth::user()->main_admin) +
+ + + +
+ @csrf + @method('DELETE') + +
+
+ @endif + @endauth +
+ {{---------------------- Product image--------------------------}} +
+ @if (substr($product->image, 0, 5) == 'https') + Responsive image + @else + Responsive image + @endif +
+
+ {{---------------------- Name and price of product--------------------------}} +
+
{{ $product->name}}
+ ${{ number_format($product->price)}} +
- {{---------------------- Cart buttons--------------------------}} -
-
- @csrf -
- - See - - -
-
-
- {{---------------------- End of Cart buttons--------------------------}} + {{---------------------- Cart buttons--------------------------}} +
+
+ @csrf +
+ + See + + +
+
+
+ {{---------------------- End of Cart buttons--------------------------}} +
+
+ @endif + @empty +

No hay productos ...

+ @endforelse
-
- {{--
-
-

{{ $product->brand}}

-
- @auth - @if (Auth::user()->admin or Auth::user()->main_admin) -

- -

-
- @csrf - @method('DELETE') - -
- @endif - @endauth -
-
- Image -
- @if (substr($product->image, 0, 5) == 'https') - Responsive image - @else - Responsive image - @endif -
- Body -
-
-
{{ $product->name}}
- ${{ number_format($product->price)}} -
- Buttons -
- See -
- @csrf -
- - -
-
-
- End Buttons
-
--}} - {{-- End Card Products --}} - @endif - @empty -

No hay productos ...

- @endforelse -
- -
{{-- Pagination --}}
- {{ $products->appends(request()->query())->links()}}
+ {{ $products->appends(request()->query())->links()}}
@endsection \ No newline at end of file diff --git a/resources/views/admin/products/panel.blade.php b/resources/views/admin/products/panel.blade.php index e03f005..5752ddd 100644 --- a/resources/views/admin/products/panel.blade.php +++ b/resources/views/admin/products/panel.blade.php @@ -3,112 +3,113 @@ @section('content')
-
-
- {{-- Administrator menu --}} - @auth - @if (Auth::user()->admin or Auth::user()->main_admin) - {{-- buttons --}} - - @endif - @endauth +
+
+ {{-- Administrator menu --}} + @auth + @if (Auth::user()->admin or Auth::user()->main_admin) + {{-- buttons --}} + + @endif + @endauth - {{-- Filter form --}} -
-

Filter

- Search by Brand - + {{-- Filter form --}} + +

Filter

+ Search by Brand + - Search by name - + Search by name + - Search by price - + Search by price + -
- -
+
+ +
- -
+ + +
-
-
+
-
-

Products

+
+

Products

-
- Exportar -
- - - - - - - - - - - - - - - - - @foreach ($products as $product) - - - - - - - - - - - - - @endforeach - -
IdBrandNameUnit priceQuantityCreation dateModification dateStateSet up
{{$product->id}} - @if (substr($product->image, 0, 5) == 'https') - Responsive image - @else - Responsive image - @endif - {{$product->brand}}{{$product->name}}${{number_format($product->price)}}{{$product->quantity}}{{$product->created_at}}{{$product->updated_at}} - - -
- -
- @csrf - @method('DELETE') - -
-
-
- {{-- Pagination --}} -
{{ $products->render()}}
+
+ Exportar +
+ + + + + + + + + + + + + + + + + @foreach ($products as $product) + + + + + + + + + + + + + @endforeach + +
IdBrandNameUnit priceQuantityCreation dateModification dateStateSet up
{{$product->id}} + @if (substr($product->image, 0, 5) == 'https') + Responsive image + @else + Responsive image + @endif + {{$product->brand}}{{$product->name}}${{number_format($product->price)}}{{$product->quantity}}{{$product->created_at}}{{$product->updated_at}} + + +
+ +
+ @csrf + @method('DELETE') + +
+
+
+ {{-- Pagination --}} +
{{ $products->render()}}
+
-
@endsection \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index c4435d5..c7fe92c 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,6 +1,5 @@ name('export'); // pruebas -Route::get('/rangualiado', function () +Route::get('/lleve', function () { - dd(request()->userAgent()); + $pdf = App::make('dompdf.wrapper'); + + $pdf->loadHTML('

Test

'); + + return $pdf->stream(); }); \ No newline at end of file