diff --git a/app/Http/Controllers/admin/ProductController.php b/app/Http/Controllers/admin/ProductController.php index fb6ad9c..adce059 100644 --- a/app/Http/Controllers/admin/ProductController.php +++ b/app/Http/Controllers/admin/ProductController.php @@ -4,116 +4,90 @@ use App\Http\Controllers\Controller; use Illuminate\Http\Request; - use App\Models\Product; use App\Models\Category; use App\Models\Subcategory; -// use for string conversion use Illuminate\Support\Str; -use Illuminate\Support\Facades\Storage; +use Illuminate\Support\Facades\DB; // Import DB facade + class ProductController extends Controller { public function index() { $categories = Category::latest()->get(); $subcategories = Subcategory::latest()->get(); - $products = Product::latest()->paginate(9); + $products = Product::latest()->get(); return view('admin.product.allProduct', compact('categories', 'subcategories', 'products')); } - public function create() { - // Fetch categories and subcategories for the dropdowns $categories = Category::latest()->get(); $subcategories = Subcategory::latest()->get(); - // $categories = Category::all(); - // $subcategories = Subcategory::all(); - // Return the view with categories and subcategories return view('admin.product.addProduct', compact('categories', 'subcategories')); } - // Store a newly created product in storage public function store(Request $request) { - // Validate the incoming request - $request->validate([ - 'product_img' => 'required|image|mimes:jpeg,png,jpg,gif|max:2048', // Adjust validation rules as needed - 'product_name' => 'required|string|max:255', - 'product_short_des' => 'nullable|string|max:500', - 'product_des' => 'nullable|string', - 'product_price' => 'required|numeric', - 'product_category_id' => 'required|exists:categories,id', - 'product_subcategory_id' => 'required|exists:subcategories,id', - 'product_quantity' => 'required|integer|min:1', - ]); - - // Handle the image upload - $image = $request->file('product_img'); - $img_name = hexdec(uniqid()).'.'.$image->getClientOriginalExtension(); - - // Move the image to the public 'upload' directory - $image->move(public_path('products'), $img_name); - - // Generate the URL or path to the image - $img_url = 'products/'.$img_name; - - // Create the product - Product::create([ - 'product_name' => $request->input('product_name'), - 'product_short_des' => $request->input('product_short_des'), - 'product_des' => $request->input('product_des'), - 'product_price' => $request->input('product_price'), - 'product_category_id' => $request->input('product_category_id'), - 'product_subcategory_id' => $request->input('product_subcategory_id'), - 'product_quantity' => $request->input('product_quantity'), - 'product_img' => $img_name, // Ensure consistency here - 'slug' => strtolower(str_replace(' ', '-', $request->input('product_name'))) - ]); - // Update the product count in the related category and subcategory - $category_id = $request->input('product_category_id'); - $subcategory_id = $request->input('product_subcategory_id'); - - Category::where('id', $category_id)->increment('product_count',1); - SubCategory::where('id', $subcategory_id)->increment('product_count',1); - - // Redirect with success message - return redirect()->route('product')->with([ - 'message' => 'Product created successfully!', - 'alert-type' => 'success' + $request->validate([ + 'product_img' => 'required|image|mimes:jpeg,png,jpg,gif|max:2048', + 'product_name' => 'required|string|max:255', + 'product_short_des' => 'nullable|string|max:500', + 'product_des' => 'nullable|string', + 'product_price' => 'required|numeric', + 'product_category_id' => 'required|exists:categories,id', + 'product_subcategory_id' => 'required|exists:subcategories,id', + 'product_quantity' => 'required|integer|min:1', ]); - } - + $img_name = hexdec(uniqid()) . '.' . $request->file('product_img')->getClientOriginalExtension(); + $request->file('product_img')->move(public_path('products'), $img_name); + + $success = Product::create([ + 'product_name' => $request->input('product_name'), + 'product_short_des' => $request->input('product_short_des'), + 'product_des' => $request->input('product_des'), + 'product_price' => $request->input('product_price'), + 'product_category_id' => $request->input('product_category_id'), + 'product_subcategory_id' => $request->input('product_subcategory_id'), + 'product_quantity' => $request->input('product_quantity'), + 'product_img' => $img_name, + 'slug' => strtolower(str_replace(' ', '-', $request->input('product_name'))) + ]); - - public function show(string $id) - { - // + if ($success) { + // Update product count + Category::where('id', $request->input('product_category_id'))->increment('product_count', 1); + Subcategory::where('id', $request->input('product_subcategory_id'))->increment('product_count', 1); + + $notification = array( + 'message' => 'Product created successfully!', + 'alert-type' => 'success' + ); + return redirect()->route('product')->with($notification); + } else { + $notification = array( + 'message' => 'Product could not be created.', + 'alert-type' => 'error' + ); + return redirect()->back()->with($notification); + } } - - // Show the edit form public function edit($id) { - // Fetch the product to be edited $product = Product::findOrFail($id); - - // Fetch categories and subcategories for the dropdowns $categories = Category::all(); $subcategories = Subcategory::all(); - // Pass the product and categories to the view return view('admin.product.editProduct', compact('product', 'categories', 'subcategories')); } - public function update(Request $request, string $id) { - // Step 1: Validate the request - $request->validate([ + $request->validate([ 'product_name' => 'required|string|max:255', 'product_short_des' => 'required|string|max:255', 'product_des' => 'required|string', @@ -122,72 +96,68 @@ public function update(Request $request, string $id) 'product_category_id' => 'required|exists:categories,id', 'product_subcategory_id' => 'nullable|exists:subcategories,id', 'slug' => 'nullable|string|max:255', - 'product_img' => 'nullable|image|mimes:jpeg,png,jpg,gif|max:2048', // Validating image upload + 'product_img' => 'nullable|image|mimes:jpeg,png,jpg,gif|max:2048', ]); - // Step 2: Find the product $product = Product::findOrFail($id); + $product->fill($request->except('product_img')); + + $success = true; - // Step 3: Update product details - $product->product_name = $request->product_name; - $product->product_short_des = $request->product_short_des; - $product->product_des = $request->product_des; - $product->product_price = $request->product_price; - $product->product_quantity = $request->product_quantity; - $product->product_category_id = $request->product_category_id; - $product->product_subcategory_id = $request->product_subcategory_id; - $product->slug = $request->slug; - - // Step 4: Handle the file upload if ($request->hasFile('product_img')) { - // Delete the old image if exists + // Delete old image if it exists if ($product->product_img) { - Storage::delete('public/products/' . $product->product_img); + $oldImagePath = public_path('products/' . $product->product_img); + if (file_exists($oldImagePath)) { + unlink($oldImagePath); + } } - - // Store the new image and set the product_img path - $imagePath = $request->file('product_img')->store('products', 'public'); - $product->product_img = $imagePath; + + // Store the new image + $img_name = hexdec(uniqid()) . '.' . $request->file('product_img')->getClientOriginalExtension(); + $request->file('product_img')->move(public_path('products'), $img_name); + $product->product_img = $img_name; } - // Save the updated product - $product->save(); - - // Step 5: Redirect or respond - return redirect()->route('product')->with('success', 'Product updated successfully.'); + $success = $product->save(); + + if ($success) { + $notification = array( + 'message' => 'Product updated successfully!', + 'alert-type' => 'success' + ); + return redirect()->route('product')->with($notification); + } else { + $notification = array( + 'message' => 'Product could not be updated.', + 'alert-type' => 'error' + ); + return redirect()->back()->with($notification); + } } - + public function destroy(string $id) { - // Step 1: Find the product by ID $product = Product::findOrFail($id); - $cat_id = Product::where('id',$id)->value('product_category_id'); - $subcat_id = Product::where('id',$id)->value('product_subcategory_id'); + + // Decrement product count + Category::where('id', $product->product_category_id)->decrement('product_count', 1); + Subcategory::where('id', $product->product_subcategory_id)->decrement('product_count', 1); - Category::where('id',$cat_id)->decrement('product_count',1); - SubCategory::where('id',$cat_id)->decrement('product_count',1); - // return $id;exit; - // Step 2: Delete the product image if it exists + // Delete the product image if ($product->product_img) { - // Construct the full path to the image - $imagePath = 'public/products/' . $product->product_img; - // return $imagePath;exit; - // Check if the file exists before deleting - if (file_exists($imagePath)) { + $imagePath = public_path('products/' . $product->product_img); + if (file_exists($imagePath)) { unlink($imagePath); - } else { - // Optionally log an error or message if the file doesn't exist - \Log::warning("Image not found for product ID {$id}: {$imagePath}"); } - } - // Step 3: Delete the product record $product->delete(); - // Step 4: Redirect with success message - return redirect()->route('product')->with('success', 'Product deleted successfully.'); - - + $notification = array( + 'message' => 'Product delete successfully! .', + 'alert-type' => 'success' + ); + return redirect()->back()->with($notification); } } diff --git a/db/ecommerce.sql b/db/ecommerce.sql index 5b46c7f..bae0f57 100644 --- a/db/ecommerce.sql +++ b/db/ecommerce.sql @@ -3,7 +3,7 @@ -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 --- Generation Time: Aug 14, 2024 at 02:02 PM +-- Generation Time: Sep 25, 2024 at 10:27 AM -- Server version: 10.4.32-MariaDB -- PHP Version: 8.2.12 @@ -82,35 +82,7 @@ CREATE TABLE `categories` ( -- INSERT INTO `categories` (`id`, `category_name`, `slug`, `subCategory_count`, `product_count`, `created_at`, `updated_at`) VALUES -(1, 'Food', 'food', 1, 1, '2024-08-07 11:13:44', '2024-08-07 11:14:21'); - --- -------------------------------------------------------- - --- --- Table structure for table `category` --- - -CREATE TABLE `category` ( - `id` bigint(20) UNSIGNED NOT NULL, - `category_name` varchar(255) NOT NULL, - `slug` varchar(255) NOT NULL, - `subCategory_count` int(11) NOT NULL DEFAULT 0, - `product_count` int(11) NOT NULL DEFAULT 0, - `created_at` timestamp NULL DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `dashboards` --- - -CREATE TABLE `dashboards` ( - `id` bigint(20) UNSIGNED NOT NULL, - `created_at` timestamp NULL DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +(1, 'Fashion', 'fashion', 9, 21, '2024-09-25 01:15:50', '2024-09-25 01:59:58'); -- -------------------------------------------------------- @@ -180,20 +152,20 @@ CREATE TABLE `migrations` ( -- INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES -(67, '0001_01_01_000000_create_users_table', 1), -(68, '0001_01_01_000001_create_cache_table', 1), -(69, '0001_01_01_000002_create_jobs_table', 1), -(70, '2024_07_29_060808_laratrust_setup_tables', 1), -(71, '2024_07_29_063956_create_dashboards_table', 1), -(72, '2024_07_29_070631_create_sub_categories_table', 1), -(73, '2024_07_29_070631_create_subcategories_table', 1), -(74, '2024_07_29_070631_create_subcategory_table', 1), -(75, '2024_07_29_071951_create_categories_table', 1), -(76, '2024_07_29_071951_create_category_table', 1), -(77, '2024_07_29_171637_create_products_table', 1), -(78, '2024_08_04_020350_create_cards_table', 1), -(79, '2024_08_07_170247_create_shopping_addresses_table', 2), -(81, '2024_08_10_050842_create_orders_table', 3); +(96, '0001_01_01_000000_create_users_table', 1), +(97, '0001_01_01_000001_create_cache_table', 1), +(98, '0001_01_01_000002_create_jobs_table', 1), +(99, '2024_07_29_060808_laratrust_setup_tables', 1), +(100, '2024_07_29_063956_create_dashboards_table', 1), +(101, '2024_07_29_070631_create_sub_categories_table', 1), +(102, '2024_07_29_070631_create_subcategories_table', 1), +(103, '2024_07_29_070631_create_subcategory_table', 1), +(104, '2024_07_29_071951_create_categories_table', 1), +(105, '2024_07_29_071951_create_category_table', 1), +(106, '2024_07_29_171637_create_products_table', 1), +(107, '2024_08_04_020350_create_cards_table', 1), +(108, '2024_08_07_170247_create_shopping_addresses_table', 1), +(109, '2024_08_10_050842_create_orders_table', 1); -- -------------------------------------------------------- @@ -215,16 +187,6 @@ CREATE TABLE `orders` ( `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; --- --- Dumping data for table `orders` --- - -INSERT INTO `orders` (`id`, `userId`, `ProductId`, `ProductPrice`, `ProductQty`, `userPhone`, `userPresentAddress`, `userPostalCode`, `Status`, `created_at`, `updated_at`) VALUES -(1, 2, 1, 150.00, 1, '1234567890', 'dhaka', '1345', 'success', '2024-08-09 23:52:01', '2024-08-10 01:00:28'), -(2, 2, 2, 150.00, 1, '1234567890', 'dhaka', '1345', 'success', '2024-08-09 23:52:01', '2024-08-10 01:04:24'), -(3, 2, 3, 150.00, 1, '1234567890', 'dhaka', '1345', 'pending', '2024-08-09 23:52:01', '2024-08-09 23:52:01'), -(4, 2, 4, 750.00, 5, '1234567890', 'dhaka', '1345', 'pending', '2024-08-09 23:52:01', '2024-08-09 23:52:01'); - -- -------------------------------------------------------- -- @@ -257,16 +219,16 @@ CREATE TABLE `permissions` ( -- INSERT INTO `permissions` (`id`, `name`, `display_name`, `description`, `created_at`, `updated_at`) VALUES -(1, 'users-create', 'Create Users', 'Create Users', '2024-08-07 11:11:31', '2024-08-07 11:11:31'), -(2, 'users-read', 'Read Users', 'Read Users', '2024-08-07 11:11:31', '2024-08-07 11:11:31'), -(3, 'users-update', 'Update Users', 'Update Users', '2024-08-07 11:11:31', '2024-08-07 11:11:31'), -(4, 'users-delete', 'Delete Users', 'Delete Users', '2024-08-07 11:11:31', '2024-08-07 11:11:31'), -(5, 'payments-create', 'Create Payments', 'Create Payments', '2024-08-07 11:11:31', '2024-08-07 11:11:31'), -(6, 'payments-read', 'Read Payments', 'Read Payments', '2024-08-07 11:11:31', '2024-08-07 11:11:31'), -(7, 'payments-update', 'Update Payments', 'Update Payments', '2024-08-07 11:11:31', '2024-08-07 11:11:31'), -(8, 'payments-delete', 'Delete Payments', 'Delete Payments', '2024-08-07 11:11:31', '2024-08-07 11:11:31'), -(9, 'profile-read', 'Read Profile', 'Read Profile', '2024-08-07 11:11:31', '2024-08-07 11:11:31'), -(10, 'profile-update', 'Update Profile', 'Update Profile', '2024-08-07 11:11:31', '2024-08-07 11:11:31'); +(1, 'users-create', 'Create Users', 'Create Users', '2024-09-25 01:11:48', '2024-09-25 01:11:48'), +(2, 'users-read', 'Read Users', 'Read Users', '2024-09-25 01:11:48', '2024-09-25 01:11:48'), +(3, 'users-update', 'Update Users', 'Update Users', '2024-09-25 01:11:48', '2024-09-25 01:11:48'), +(4, 'users-delete', 'Delete Users', 'Delete Users', '2024-09-25 01:11:48', '2024-09-25 01:11:48'), +(5, 'payments-create', 'Create Payments', 'Create Payments', '2024-09-25 01:11:48', '2024-09-25 01:11:48'), +(6, 'payments-read', 'Read Payments', 'Read Payments', '2024-09-25 01:11:48', '2024-09-25 01:11:48'), +(7, 'payments-update', 'Update Payments', 'Update Payments', '2024-09-25 01:11:48', '2024-09-25 01:11:48'), +(8, 'payments-delete', 'Delete Payments', 'Delete Payments', '2024-09-25 01:11:48', '2024-09-25 01:11:48'), +(9, 'profile-read', 'Read Profile', 'Read Profile', '2024-09-25 01:11:48', '2024-09-25 01:11:48'), +(10, 'profile-update', 'Update Profile', 'Update Profile', '2024-09-25 01:11:48', '2024-09-25 01:11:48'); -- -------------------------------------------------------- @@ -339,7 +301,27 @@ CREATE TABLE `products` ( -- INSERT INTO `products` (`id`, `product_name`, `product_short_des`, `product_des`, `product_price`, `product_category_id`, `product_subcategory_id`, `product_quantity`, `product_img`, `slug`, `created_at`, `updated_at`) VALUES -(1, 'najis shar', 'Lorem Ipsum is simply dummy text of the printing and typesetting industry.', 'asdf', 150.00, 1, 1, 200, '1806749779767048.png', 'najis-shar', '2024-08-07 11:14:21', '2024-08-07 11:14:21'); +(1, 'Organic Cotton T-Shirt', 'Soft, breathable tee', 'Made from 100% organic cotton, this t-shirt offers unparalleled comfort and breathability, perfect for casual outings or lounging at home.', 19.99, 1, 1, 200, '1811151905891831.jpeg', 'organic-cotton-t-shirt', '2024-09-25 01:24:15', '2024-09-25 01:24:15'), +(2, 'Recycled Polyester Jacket', 'Eco-friendly jacket', 'This stylish jacket is crafted from recycled polyester, providing warmth and protection while reducing environmental impact. Ideal for transitional weather.', 49.99, 1, 2, 200, '1811152073767870.jpeg', 'recycled-polyester-jacket', '2024-09-25 01:26:55', '2024-09-25 01:26:55'), +(3, 'Linen Summer Dress', 'Lightweight summer dress', 'Made from breathable linen, this dress is perfect for warm days. Its relaxed fit and elegant design make it versatile for both casual and dressy occasions.', 34.99, 1, 3, 200, '1811152192340778.jpeg', 'linen-summer-dress', '2024-09-25 01:28:48', '2024-09-25 01:28:48'), +(4, 'Bamboo Fiber Socks', 'Comfortable and soft socks', 'These eco-friendly socks made from bamboo fiber provide exceptional comfort and moisture-wicking properties, making them perfect for everyday wear.', 9.99, 1, 9, 200, '1811152310457121.jpeg', 'bamboo-fiber-socks', '2024-09-25 01:30:41', '2024-09-25 01:30:41'), +(5, 'Bamboo Fiber Socks', 'Comfortable and soft socks', 'These eco-friendly socks made from bamboo fiber provide exceptional comfort and moisture-wicking properties, making them perfect for everyday wear.', 9.99, 1, 9, 200, '1811152310968109.jpeg', 'bamboo-fiber-socks', '2024-09-25 01:30:42', '2024-09-25 01:30:42'), +(6, 'Denim Jeans', 'Classic denim jeans', 'Timeless and versatile, these denim jeans feature a flattering fit and durable fabric, making them a staple in any wardrobe for casual or smart-casual looks.', 39.99, 1, 5, 200, '1811152482408142.jpeg', 'denim-jeans', '2024-09-25 01:33:25', '2024-09-25 01:33:25'), +(7, 'Merino Wool Sweater', 'Warm and stylish sweater', 'This luxurious merino wool sweater is perfect for layering, offering warmth without bulk. Its soft texture makes it comfortable against the skin.', 59.99, 1, 6, 200, '1811152608315864.jpeg', 'merino-wool-sweater', '2024-09-25 01:35:25', '2024-09-25 01:35:25'), +(8, 'Cotton Pajama Set', 'Cozy pajama set', 'Enjoy a restful night’s sleep in this soft cotton pajama set, featuring a relaxed fit and breathable fabric for ultimate comfort.', 29.99, 1, 7, 200, '1811152782093457.jpeg', 'cotton-pajama-set', '2024-09-25 01:38:11', '2024-09-25 01:38:11'), +(9, 'Canvas Sneakers', 'Casual canvas sneakers', 'These versatile canvas sneakers are perfect for everyday wear, offering style and comfort with a lightweight design and classic silhouette.', 4.99, 1, 8, 200, '1811152879562245.jpeg', 'canvas-sneakers', '2024-09-25 01:39:44', '2024-09-25 01:39:44'), +(10, 'Silk Scarf', 'Elegant silk scarf', 'Add a touch of elegance to any outfit with this luxurious silk scarf, perfect for layering or as an accessory to elevate your style.', 25.00, 1, 9, 200, '1811153001711488.jpeg', 'silk-scarf', '2024-09-25 01:41:40', '2024-09-25 01:41:40'), +(11, 'Activewear Leggings', 'Flexible activewear leggings', 'These high-performance leggings are designed for comfort and flexibility during workouts, made with moisture-wicking fabric to keep you dry and comfortable.', 34.99, 1, 9, 200, '1811153162042521.jpeg', 'activewear-leggings', '2024-09-25 01:44:13', '2024-09-25 01:44:13'), +(12, 'Graphic Hoodie', 'Trendy graphic hoodie', 'Stay cozy and stylish in this graphic hoodie, featuring a unique design that adds flair to any casual outfit while providing warmth and comfort.', 39.99, 1, 2, 200, '1811153242652750.jpeg', 'graphic-hoodie', '2024-09-25 01:45:30', '2024-09-25 01:45:30'), +(13, 'Jersey Knit Dress', 'Casual jersey dress', 'This soft jersey knit dress is perfect for everyday wear, offering a relaxed fit and easy style for any occasion, whether dressed up or down.', 29.99, 1, 3, 200, '1811153366358161.jpeg', 'jersey-knit-dress', '2024-09-25 01:47:28', '2024-09-25 01:47:28'), +(14, 'Chino Shorts', 'Stylish chino shorts', 'Comfortable and stylish, these chino shorts are perfect for warm weather outings, featuring a classic cut that pairs well with any top.', 24.99, 1, 5, 200, '1811153452597907.jpeg', 'chino-shorts', '2024-09-25 01:48:50', '2024-09-25 01:48:50'), +(15, 'Modal Sleep Shirt', 'Soft modal sleep shirt', 'Experience ultimate comfort with this soft modal sleep shirt, designed for a relaxed fit and breathable fabric for a good night’s sleep.', 22.99, 1, 6, 200, '1811153656044980.jpeg', 'modal-sleep-shirt', '2024-09-25 01:52:04', '2024-09-25 01:52:04'), +(16, 'Flannel Shirt', 'Cozy flannel shirt', 'Perfect for layering, this cozy flannel shirt features a classic plaid pattern, making it an essential piece for cooler days and casual outings.', 32.99, 1, 1, 200, '1811153740735118.jpeg', 'flannel-shirt', '2024-09-25 01:53:25', '2024-09-25 01:53:25'), +(17, 'Fleece Pullover', 'Warm fleece pullover', 'This warm fleece pullover is perfect for chilly days, offering a soft and cozy feel that makes it ideal for outdoor adventures or lounging at home.', 39.99, 1, 2, 200, '1811153815871760.jpeg', 'fleece-pullover', '2024-09-25 01:54:37', '2024-09-25 01:54:37'), +(18, 'Cargo Pants', 'Functional cargo pants', 'These versatile cargo pants feature multiple pockets and a relaxed fit, perfect for both outdoor activities and everyday casual wear.', 29.99, 1, 5, 200, '1811153884960064.jpeg', 'cargo-pants', '2024-09-25 01:55:43', '2024-09-25 01:55:43'), +(19, 'Wool Blend Beanie', 'Warm wool blend beanie', 'Stay warm and stylish with this wool blend beanie, perfect for chilly days. Its snug fit makes it a cozy accessory for any winter outfit.', 19.99, 1, 4, 200, '1811153965918242.jpeg', 'wool-blend-beanie', '2024-09-25 01:57:00', '2024-09-25 01:57:00'), +(20, 'Chambray Shirt', 'Classic chambray shirt', 'This classic chambray shirt is a versatile wardrobe staple, ideal for layering or wearing on its own. Its lightweight fabric ensures comfort throughout the day.', 29.99, 1, 1, 200, '1811154030339981.jpeg', 'chambray-shirt', '2024-09-25 01:58:01', '2024-09-25 01:58:01'), +(21, 'High-Waisted Leggings', 'Trendy high-waisted leggings', 'Designed for both style and function, these high-waisted leggings offer support and comfort for any workout while providing a flattering silhouette.', 34.99, 1, 9, 200, '1811154152421718.jpeg', 'high-waisted-leggings', '2024-09-25 01:59:58', '2024-09-25 01:59:58'); -- -------------------------------------------------------- @@ -361,8 +343,8 @@ CREATE TABLE `roles` ( -- INSERT INTO `roles` (`id`, `name`, `display_name`, `description`, `created_at`, `updated_at`) VALUES -(1, 'admin', 'Admin', 'Admin', '2024-08-07 11:11:31', '2024-08-07 11:11:31'), -(2, 'user', 'User', 'User', '2024-08-07 11:11:31', '2024-08-07 11:11:31'); +(1, 'admin', 'Admin', 'Admin', '2024-09-25 01:11:48', '2024-09-25 01:11:48'), +(2, 'user', 'User', 'User', '2024-09-25 01:11:48', '2024-09-25 01:11:48'); -- -------------------------------------------------------- @@ -381,8 +363,7 @@ CREATE TABLE `role_user` ( -- INSERT INTO `role_user` (`role_id`, `user_id`, `user_type`) VALUES -(1, 1, 'App\\Models\\User'), -(2, 2, 'App\\Models\\User'); +(1, 1, 'App\\Models\\User'); -- -------------------------------------------------------- @@ -404,8 +385,7 @@ CREATE TABLE `sessions` ( -- INSERT INTO `sessions` (`id`, `user_id`, `ip_address`, `user_agent`, `payload`, `last_activity`) VALUES -('Loh0ILZsgSQOgeMPCuq2eDJ1MyWeUbADcQXCKM5P', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36 Edg/127.0.0.0', 'YTo0OntzOjY6Il90b2tlbiI7czo0MDoiOFRwVkdtYWc4ZjJQdnJYZFlzY0FCTDhsZkdkUE9CVEY0blE5cXMyTCI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6MjE6Imh0dHA6Ly8xMjcuMC4wLjE6ODAwMCI7fXM6NjoiX2ZsYXNoIjthOjI6e3M6Mzoib2xkIjthOjA6e31zOjM6Im5ldyI7YTowOnt9fXM6NTA6ImxvZ2luX3dlYl81OWJhMzZhZGRjMmIyZjk0MDE1ODBmMDE0YzdmNThlYTRlMzA5ODlkIjtpOjE7fQ==', 1723636622), -('Th49guuxzyjYVvLDIwf9CiU3nR0fjL0ee4FAvw4f', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36 Edg/127.0.0.0', 'YTo0OntzOjY6Il90b2tlbiI7czo0MDoiWk5hWlBOa2VnczdBcjBwUW5QM2FEdUhqUjgzMWcyaWRidTk3NXd6USI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6MjE6Imh0dHA6Ly8xMjcuMC4wLjE6ODAwMCI7fXM6NjoiX2ZsYXNoIjthOjI6e3M6Mzoib2xkIjthOjA6e31zOjM6Im5ldyI7YTowOnt9fXM6NTA6ImxvZ2luX3dlYl81OWJhMzZhZGRjMmIyZjk0MDE1ODBmMDE0YzdmNThlYTRlMzA5ODlkIjtpOjE7fQ==', 1723618811); +('9wY4BULdRHqgcOiGYpQtqICNCB53KJvwqafDqpYu', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36 Edg/129.0.0.0', 'YTo0OntzOjY6Il90b2tlbiI7czo0MDoidFBDVlhDdXFaRzlMRWFKMVM5SUVVaGJSQ3o4NThnQThZVWtEcW1aZCI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6MjE6Imh0dHA6Ly8xMjcuMC4wLjE6ODAwMCI7fXM6NjoiX2ZsYXNoIjthOjI6e3M6Mzoib2xkIjthOjA6e31zOjM6Im5ldyI7YTowOnt9fXM6NTA6ImxvZ2luX3dlYl81OWJhMzZhZGRjMmIyZjk0MDE1ODBmMDE0YzdmNThlYTRlMzA5ODlkIjtpOjE7fQ==', 1727252856); -- -------------------------------------------------------- @@ -423,15 +403,6 @@ CREATE TABLE `shopping_addresses` ( `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; --- --- Dumping data for table `shopping_addresses` --- - -INSERT INTO `shopping_addresses` (`id`, `userId`, `phoneNumber`, `presentAddress`, `postalCode`, `created_at`, `updated_at`) VALUES -(1, 2, '1234567890', 'dhaka', '1345', '2024-08-09 21:54:29', '2024-08-09 21:54:29'), -(2, 2, '1234567890', 'dhaka', '1345', '2024-08-09 22:14:17', '2024-08-09 22:14:17'), -(3, 2, '1234567890', 'dhaka', '1345', '2024-08-09 23:16:14', '2024-08-09 23:16:14'); - -- -------------------------------------------------------- -- @@ -454,41 +425,15 @@ CREATE TABLE `subcategories` ( -- INSERT INTO `subcategories` (`id`, `subcategory_name`, `category_id`, `category_name`, `product_count`, `slug`, `created_at`, `updated_at`) VALUES -(1, 'Rice', 1, 'Food', 1, 'rice', '2024-08-07 11:13:56', '2024-08-07 11:14:21'); - --- -------------------------------------------------------- - --- --- Table structure for table `subcategory` --- - -CREATE TABLE `subcategory` ( - `id` bigint(20) UNSIGNED NOT NULL, - `subcategory_name` varchar(255) NOT NULL, - `category_id` bigint(20) NOT NULL, - `category_name` varchar(255) NOT NULL, - `product_count` int(11) NOT NULL DEFAULT 0, - `slug` varchar(255) NOT NULL, - `created_at` timestamp NULL DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `sub_categories` --- - -CREATE TABLE `sub_categories` ( - `id` bigint(20) UNSIGNED NOT NULL, - `subcategory_name` varchar(255) NOT NULL, - `category_id` bigint(20) NOT NULL, - `category_name` varchar(255) NOT NULL, - `product_count` int(11) NOT NULL DEFAULT 0, - `slug` varchar(255) NOT NULL, - `created_at` timestamp NULL DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +(1, 'Tops', 1, 'Fashion', 3, 'tops', '2024-09-25 01:16:29', '2024-09-25 01:58:01'), +(2, 'Outerwear', 1, 'Fashion', 3, 'outerwear', '2024-09-25 01:16:42', '2024-09-25 01:54:37'), +(3, 'Dresses', 1, 'Fashion', 2, 'dresses', '2024-09-25 01:16:51', '2024-09-25 01:47:28'), +(4, 'Accessories', 1, 'Fashion', 1, 'accessories', '2024-09-25 01:17:03', '2024-09-25 01:57:00'), +(5, 'Bottoms', 1, 'Fashion', 3, 'bottoms', '2024-09-25 01:17:12', '2024-09-25 01:55:43'), +(6, 'Sweaters', 1, 'Fashion', 2, 'sweaters', '2024-09-25 01:17:27', '2024-09-25 01:52:04'), +(7, 'Sleepwear', 1, 'Fashion', 1, 'sleepwear', '2024-09-25 01:17:35', '2024-09-25 01:38:11'), +(8, 'Footwear', 1, 'Fashion', 1, 'footwear', '2024-09-25 01:17:44', '2024-09-25 01:39:44'), +(9, 'Activewear', 1, 'Fashion', 5, 'activewear', '2024-09-25 01:18:08', '2024-09-25 01:59:58'); -- -------------------------------------------------------- @@ -512,8 +457,7 @@ CREATE TABLE `users` ( -- INSERT INTO `users` (`id`, `name`, `email`, `email_verified_at`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES -(1, 'lemon', 'lemon12@gmail.com', NULL, '$2y$12$jc9LDM7Xap4ckRlOB9pxTu6nz7tgnT6n/kQeZXLYLUL9Oc1NDLn6q', NULL, '2024-08-07 11:12:39', '2024-08-07 11:12:39'), -(2, 'leon', 'leon@gmail.com', NULL, '$2y$12$dJZ7v.xgXSng0mJ.4V7YXuV.ijV14dV.p7sy8ImUOlNC4viFjP3iu', NULL, '2024-08-07 11:15:21', '2024-08-07 11:15:21'); +(1, 'Lemon', 'lemon@gmail.com', NULL, '$2y$12$rC4h8CHTGakADEBu0Ukcgup7N0x6wS7tjDVvdMk1jZxLJ9gDG11yK', NULL, '2024-09-25 01:12:31', '2024-09-25 01:12:31'); -- -- Indexes for dumped tables @@ -543,18 +487,6 @@ ALTER TABLE `cards` ALTER TABLE `categories` ADD PRIMARY KEY (`id`); --- --- Indexes for table `category` --- -ALTER TABLE `category` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `dashboards` --- -ALTER TABLE `dashboards` - ADD PRIMARY KEY (`id`); - -- -- Indexes for table `failed_jobs` -- @@ -654,18 +586,6 @@ ALTER TABLE `shopping_addresses` ALTER TABLE `subcategories` ADD PRIMARY KEY (`id`); --- --- Indexes for table `subcategory` --- -ALTER TABLE `subcategory` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `sub_categories` --- -ALTER TABLE `sub_categories` - ADD PRIMARY KEY (`id`); - -- -- Indexes for table `users` -- @@ -681,7 +601,7 @@ ALTER TABLE `users` -- AUTO_INCREMENT for table `cards` -- ALTER TABLE `cards` - MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; + MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `categories` @@ -689,18 +609,6 @@ ALTER TABLE `cards` ALTER TABLE `categories` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; --- --- AUTO_INCREMENT for table `category` --- -ALTER TABLE `category` - MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `dashboards` --- -ALTER TABLE `dashboards` - MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; - -- -- AUTO_INCREMENT for table `failed_jobs` -- @@ -717,13 +625,13 @@ ALTER TABLE `jobs` -- AUTO_INCREMENT for table `migrations` -- ALTER TABLE `migrations` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=82; + MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=110; -- -- AUTO_INCREMENT for table `orders` -- ALTER TABLE `orders` - MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; + MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `permissions` @@ -735,7 +643,7 @@ ALTER TABLE `permissions` -- AUTO_INCREMENT for table `products` -- ALTER TABLE `products` - MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; + MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22; -- -- AUTO_INCREMENT for table `roles` @@ -747,31 +655,19 @@ ALTER TABLE `roles` -- AUTO_INCREMENT for table `shopping_addresses` -- ALTER TABLE `shopping_addresses` - MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; + MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `subcategories` -- ALTER TABLE `subcategories` - MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; - --- --- AUTO_INCREMENT for table `subcategory` --- -ALTER TABLE `subcategory` - MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `sub_categories` --- -ALTER TABLE `sub_categories` - MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; + MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10; -- -- AUTO_INCREMENT for table `users` -- ALTER TABLE `users` - MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; + MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- Constraints for dumped tables diff --git a/resources/views/admin/dashboard.blade.php b/resources/views/admin/dashboard.blade.php index f63a0d9..b3bb013 100644 --- a/resources/views/admin/dashboard.blade.php +++ b/resources/views/admin/dashboard.blade.php @@ -1,8 +1,344 @@ @extends('admin.layouts.layout') @section('main') -Dashboard +

Page /Dashboard

+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
Profile Views
+
112.000
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
Followers
+
183.000
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
Following
+
80.000
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
Saved Post
+
112
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+
+

Visitors Profile

+
+
+
+
+ +
+
Male +
+
Female +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 70.0% + 30.0% + + + + + + + +
+
+
+
+
Female: + 30
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + @endsection \ No newline at end of file diff --git a/resources/views/admin/layouts/layout.blade.php b/resources/views/admin/layouts/layout.blade.php index 49f16d2..c3f8a66 100644 --- a/resources/views/admin/layouts/layout.blade.php +++ b/resources/views/admin/layouts/layout.blade.php @@ -38,11 +38,11 @@ class="template-customizer-theme-css" /> - - - - - + + + + + @@ -68,7 +68,7 @@ class="template-customizer-theme-css" />