├── public ├── favicon.ico ├── robots.txt ├── images │ ├── boot.jpg │ ├── hat.jpg │ ├── hoodie.jpg │ ├── jeans.jpg │ ├── short.jpg │ ├── sneaker.jpg │ ├── green-shirt.jpg │ └── sweatshirt.jpg ├── demo │ ├── dashboard.gif │ ├── dashboard.mp4 │ └── DB_structure.png ├── .htaccess └── index.php ├── database ├── .gitignore ├── factories │ ├── AttributeFactory.php │ ├── CategoryFactory.php │ ├── OrderFactory.php │ ├── PaymentFactory.php │ ├── ProductFactory.php │ └── UserFactory.php ├── seeders │ ├── DatabaseSeeder.php │ ├── CategorySeeder.php │ └── ProductSeeder.php └── migrations │ ├── 2022_11_07_203816_create_categories_table.php │ ├── 2014_10_12_100000_create_password_resets_table.php │ ├── 2022_11_21_153523_create_images_table.php │ ├── 2022_11_15_131105_create_whishlists_table.php │ ├── 2014_10_12_000000_create_users_table.php │ ├── 2019_08_19_000000_create_failed_jobs_table.php │ ├── 2022_11_08_220052_create_carts_table.php │ ├── 2022_11_14_215514_create_order_product_table.php │ ├── 2022_11_14_212721_create_orders_table.php │ ├── 2022_11_07_210742_create_products_table.php │ ├── 2019_12_14_000001_create_personal_access_tokens_table.php │ ├── 2022_11_16_121317_create_payments_table.php │ └── 2022_11_14_220913_create_order_details_table.php ├── bootstrap ├── cache │ └── .gitignore └── app.php ├── storage ├── logs │ └── .gitignore ├── app │ ├── public │ │ └── .gitignore │ └── .gitignore ├── framework │ ├── testing │ │ └── .gitignore │ ├── views │ │ └── .gitignore │ ├── cache │ │ ├── data │ │ │ └── .gitignore │ │ └── .gitignore │ ├── sessions │ │ └── .gitignore │ └── .gitignore └── clockwork │ └── .gitignore ├── resources ├── css │ └── app.css ├── js │ ├── Pages │ │ ├── Checkout │ │ │ ├── Failure.vue │ │ │ └── Success.vue │ │ ├── Error.vue │ │ ├── Auth │ │ │ ├── ConfirmPassword.vue │ │ │ ├── VerifyEmail.vue │ │ │ └── ResetPassword.vue │ │ └── Dashboard │ │ │ └── Settings │ │ │ └── Profile.vue │ ├── Components │ │ ├── Breeze │ │ │ ├── InputError.vue │ │ │ ├── InputLabel.vue │ │ │ ├── DropdownLink.vue │ │ │ ├── PrimaryButton.vue │ │ │ ├── TextInput.vue │ │ │ ├── Checkbox.vue │ │ │ ├── NavLink.vue │ │ │ ├── ResponsiveNavLink.vue │ │ │ ├── Dropdown.vue │ │ │ └── ApplicationLogo.vue │ │ ├── Pagination.vue │ │ ├── ProductFilters │ │ │ ├── SortProducts.vue │ │ │ ├── ProductSearch.vue │ │ │ ├── ProductPriceFilter.vue │ │ │ ├── ProductCategoryFilter.vue │ │ │ └── AppliedFilters.vue │ │ ├── ShopNavbar │ │ │ └── TheWhishlist.vue │ │ ├── FlashErrorMessage.vue │ │ ├── FlashMessage.vue │ │ ├── ShopNavbar.vue │ │ ├── Dashboard │ │ │ ├── DashboardNavbar.vue │ │ │ ├── Bar.vue │ │ │ └── DashboardAsideMenu.vue │ │ └── ProductCard.vue │ ├── Layouts │ │ ├── GuestLayout.vue │ │ ├── ShopLayout.vue │ │ └── DashboardLayout.vue │ ├── app.js │ └── bootstrap.js └── views │ └── app.blade.php ├── postcss.config.js ├── app ├── Enums │ ├── PaymentStatus.php │ └── OrderStatus.php ├── Models │ ├── Attribute.php │ ├── Image.php │ ├── OrderDetail.php │ ├── Category.php │ ├── Payment.php │ ├── Cart.php │ ├── Whishlist.php │ ├── User.php │ ├── Order.php │ └── Product.php ├── Traits │ └── Sluggable.php ├── Http │ ├── Middleware │ │ ├── EncryptCookies.php │ │ ├── VerifyCsrfToken.php │ │ ├── PreventRequestsDuringMaintenance.php │ │ ├── TrustHosts.php │ │ ├── TrimStrings.php │ │ ├── Authenticate.php │ │ ├── ValidateSignature.php │ │ ├── TrustProxies.php │ │ ├── RedirectIfAuthenticated.php │ │ └── HandleInertiaRequests.php │ ├── Controllers │ │ ├── MoveToCartController.php │ │ ├── ProductController.php │ │ ├── Controller.php │ │ ├── SaveForLaterController.php │ │ ├── DashboardSettingsProfileController.php │ │ ├── WhishlistController.php │ │ ├── DashboardOrderController.php │ │ ├── Auth │ │ │ ├── EmailVerificationPromptController.php │ │ │ ├── EmailVerificationNotificationController.php │ │ │ ├── VerifyEmailController.php │ │ │ ├── ConfirmablePasswordController.php │ │ │ ├── RegisteredUserController.php │ │ │ ├── AuthenticatedSessionController.php │ │ │ ├── PasswordResetLinkController.php │ │ │ └── NewPasswordController.php │ │ ├── DashboardSettingsPasswordController.php │ │ ├── ShopController.php │ │ └── CartController.php │ ├── Resources │ │ ├── OrderResource.php │ │ ├── ProductResource.php │ │ └── CategoryResource.php │ ├── Requests │ │ └── Auth │ │ │ └── LoginRequest.php │ └── Kernel.php ├── Providers │ ├── BroadcastServiceProvider.php │ ├── AppServiceProvider.php │ ├── AuthServiceProvider.php │ ├── EventServiceProvider.php │ └── RouteServiceProvider.php ├── Console │ └── Kernel.php └── Exceptions │ └── Handler.php ├── jsconfig.json ├── tests ├── TestCase.php ├── CreatesApplication.php ├── Unit │ ├── CartTest.php │ ├── CategoryTest.php │ ├── PaymentTest.php │ ├── OrderTest.php │ ├── UserTest.php │ └── ProductTest.php └── Feature │ ├── Auth │ ├── RegistrationTest.php │ ├── AuthenticationTest.php │ ├── PasswordConfirmationTest.php │ ├── EmailVerificationTest.php │ └── PasswordResetTest.php │ ├── Order │ └── OrderTest.php │ ├── Cart │ ├── CartTotalTest.php │ ├── ViewCartProductsTest.php │ ├── SaveForLaterTest.php │ ├── UpdateProductsInCartTest.php │ └── AddProductsToCartTest.php │ ├── Dashboard │ ├── DashboardSettingsProfileTest.php │ └── DashboardSettingsPassworTest.php │ ├── Product │ └── ShowProductTest.php │ └── ShopTest.php ├── .gitattributes ├── .gitignore ├── .editorconfig ├── vite.config.js ├── lang └── en │ ├── pagination.php │ ├── auth.php │ └── passwords.php ├── routes ├── channels.php ├── api.php ├── console.php └── auth.php ├── package.json ├── config ├── cors.php ├── services.php ├── view.php ├── hashing.php ├── broadcasting.php ├── sanctum.php ├── filesystems.php └── queue.php ├── tailwind.config.js ├── phpunit.xml ├── .env.example ├── README.md ├── artisan └── composer.json /public/favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite* 2 | -------------------------------------------------------------------------------- /bootstrap/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /storage/app/public/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !public/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/framework/testing/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/clockwork/.gitignore: -------------------------------------------------------------------------------- 1 | *.json 2 | *.json.gz 3 | index 4 | -------------------------------------------------------------------------------- /storage/framework/cache/data/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !data/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /resources/css/app.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | -------------------------------------------------------------------------------- /public/images/boot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jordan-Bianco/Ecommerce/HEAD/public/images/boot.jpg -------------------------------------------------------------------------------- /public/images/hat.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jordan-Bianco/Ecommerce/HEAD/public/images/hat.jpg -------------------------------------------------------------------------------- /public/images/hoodie.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jordan-Bianco/Ecommerce/HEAD/public/images/hoodie.jpg -------------------------------------------------------------------------------- /public/images/jeans.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jordan-Bianco/Ecommerce/HEAD/public/images/jeans.jpg -------------------------------------------------------------------------------- /public/images/short.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jordan-Bianco/Ecommerce/HEAD/public/images/short.jpg -------------------------------------------------------------------------------- /public/demo/dashboard.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jordan-Bianco/Ecommerce/HEAD/public/demo/dashboard.gif -------------------------------------------------------------------------------- /public/demo/dashboard.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jordan-Bianco/Ecommerce/HEAD/public/demo/dashboard.mp4 -------------------------------------------------------------------------------- /public/images/sneaker.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jordan-Bianco/Ecommerce/HEAD/public/images/sneaker.jpg -------------------------------------------------------------------------------- /public/demo/DB_structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jordan-Bianco/Ecommerce/HEAD/public/demo/DB_structure.png -------------------------------------------------------------------------------- /public/images/green-shirt.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jordan-Bianco/Ecommerce/HEAD/public/images/green-shirt.jpg -------------------------------------------------------------------------------- /public/images/sweatshirt.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jordan-Bianco/Ecommerce/HEAD/public/images/sweatshirt.jpg -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /resources/js/Pages/Checkout/Failure.vue: -------------------------------------------------------------------------------- 1 | 3 | 4 | -------------------------------------------------------------------------------- /storage/framework/.gitignore: -------------------------------------------------------------------------------- 1 | compiled.php 2 | config.php 3 | down 4 | events.scanned.php 5 | maintenance.php 6 | routes.php 7 | routes.scanned.php 8 | schedule-* 9 | services.json 10 | -------------------------------------------------------------------------------- /app/Enums/PaymentStatus.php: -------------------------------------------------------------------------------- 1 | 2 | defineProps(['message']); 3 | 4 | 5 | 12 | -------------------------------------------------------------------------------- /resources/js/Components/Breeze/InputLabel.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /public/build 3 | /public/hot 4 | /public/storage 5 | /storage/*.key 6 | /vendor 7 | .env 8 | .env.backup 9 | .env.production 10 | .phpunit.result.cache 11 | Homestead.json 12 | Homestead.yaml 13 | auth.json 14 | npm-debug.log 15 | yarn-error.log 16 | /.fleet 17 | /.idea 18 | /.vscode 19 | -------------------------------------------------------------------------------- /app/Traits/Sluggable.php: -------------------------------------------------------------------------------- 1 | slug = Str::slug($model->name); 14 | }); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/Models/Image.php: -------------------------------------------------------------------------------- 1 | morphTo(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | indent_size = 4 7 | indent_style = space 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | 14 | [*.{yml,yaml}] 15 | indent_size = 2 16 | 17 | [docker-compose.yml] 18 | indent_size = 4 19 | -------------------------------------------------------------------------------- /app/Models/OrderDetail.php: -------------------------------------------------------------------------------- 1 | belongsTo(Order::class); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /resources/js/Components/Breeze/DropdownLink.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | -------------------------------------------------------------------------------- /app/Models/Category.php: -------------------------------------------------------------------------------- 1 | hasMany(Product::class); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/EncryptCookies.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/VerifyCsrfToken.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | '/webhook' 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Controllers/MoveToCartController.php: -------------------------------------------------------------------------------- 1 | user()->cart->firstWhere('id', $id); 12 | 13 | $productInCart->pivot->saved_for_later = false; 14 | $productInCart->pivot->save(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/Http/Controllers/ProductController.php: -------------------------------------------------------------------------------- 1 | new ProductResource($product->load('category')) 14 | ]); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | 2 | import ApplicationLogo from "@/Components/Breeze/ApplicationLogo.vue"; 3 | 4 | 5 | 11 | -------------------------------------------------------------------------------- /app/Models/Payment.php: -------------------------------------------------------------------------------- 1 | belongsTo(User::class); 15 | } 16 | 17 | public function order() 18 | { 19 | return $this->belongsTo(Order::class); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/Http/Middleware/PreventRequestsDuringMaintenance.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrustHosts.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | public function hosts() 15 | { 16 | return [ 17 | $this->allSubdomainsOfApplicationUrl(), 18 | ]; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/Http/Controllers/SaveForLaterController.php: -------------------------------------------------------------------------------- 1 | user()->cart->firstWhere('id', $id); 12 | 13 | $productInCart->pivot->saved_for_later = true; 14 | $productInCart->pivot->quantity = 1; 15 | $productInCart->pivot->save(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrimStrings.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | 'current_password', 16 | 'password', 17 | 'password_confirmation', 18 | ]; 19 | } 20 | -------------------------------------------------------------------------------- /tests/CreatesApplication.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class)->bootstrap(); 19 | 20 | return $app; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/Providers/BroadcastServiceProvider.php: -------------------------------------------------------------------------------- 1 | create(); 17 | 18 | $this->assertInstanceOf(Collection::class, $user->cart); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/Http/Resources/OrderResource.php: -------------------------------------------------------------------------------- 1 | create(); 17 | 18 | $this->assertInstanceOf(Collection::class, $category->products); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/Http/Resources/CategoryResource.php: -------------------------------------------------------------------------------- 1 | 2 | import ShopLayout from '@/Layouts/ShopLayout.vue'; 3 | 4 | const props = defineProps({ 5 | code: Number, 6 | message: String 7 | }); 8 | 9 | 10 | -------------------------------------------------------------------------------- /vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite'; 2 | import laravel from 'laravel-vite-plugin'; 3 | import vue from '@vitejs/plugin-vue'; 4 | 5 | export default defineConfig({ 6 | plugins: [ 7 | laravel({ 8 | input: 'resources/js/app.js', 9 | refresh: true, 10 | }), 11 | vue({ 12 | template: { 13 | transformAssetUrls: { 14 | base: null, 15 | includeAbsolute: false, 16 | }, 17 | }, 18 | }), 19 | ], 20 | }); 21 | -------------------------------------------------------------------------------- /app/Http/Middleware/Authenticate.php: -------------------------------------------------------------------------------- 1 | expectsJson()) { 18 | return route('login'); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/Http/Middleware/ValidateSignature.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 'fbclid', 16 | // 'utm_campaign', 17 | // 'utm_content', 18 | // 'utm_medium', 19 | // 'utm_source', 20 | // 'utm_term', 21 | ]; 22 | } 23 | -------------------------------------------------------------------------------- /resources/js/Components/Breeze/PrimaryButton.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 17 | -------------------------------------------------------------------------------- /lang/en/pagination.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 'next' => 'Next »', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /database/factories/AttributeFactory.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class AttributeFactory extends Factory 11 | { 12 | /** 13 | * Define the model's default state. 14 | * 15 | * @return array 16 | */ 17 | public function definition() 18 | { 19 | return [ 20 | 'name' => $this->faker->word, 21 | 'description' => $this->faker->paragraph(), 22 | ]; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /routes/channels.php: -------------------------------------------------------------------------------- 1 | id === (int) $id; 18 | }); 19 | -------------------------------------------------------------------------------- /routes/api.php: -------------------------------------------------------------------------------- 1 | get('/user', function (Request $request) { 18 | return $request->user(); 19 | }); 20 | -------------------------------------------------------------------------------- /resources/js/Components/Breeze/TextInput.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 24 | -------------------------------------------------------------------------------- /routes/console.php: -------------------------------------------------------------------------------- 1 | comment(Inspiring::quote()); 19 | })->purpose('Display an inspiring quote'); 20 | -------------------------------------------------------------------------------- /public/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews -Indexes 4 | 5 | 6 | RewriteEngine On 7 | 8 | # Handle Authorization Header 9 | RewriteCond %{HTTP:Authorization} . 10 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 11 | 12 | # Redirect Trailing Slashes If Not A Folder... 13 | RewriteCond %{REQUEST_FILENAME} !-d 14 | RewriteCond %{REQUEST_URI} (.+)/$ 15 | RewriteRule ^ %1 [L,R=301] 16 | 17 | # Send Requests To Front Controller... 18 | RewriteCond %{REQUEST_FILENAME} !-d 19 | RewriteCond %{REQUEST_FILENAME} !-f 20 | RewriteRule ^ index.php [L] 21 | 22 | -------------------------------------------------------------------------------- /database/seeders/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | create([ 20 | 'name' => 'user', 21 | 'email' => 'user@mail.com', 22 | ]); 23 | 24 | $this->call(CategorySeeder::class); 25 | $this->call(ProductSeeder::class); 26 | $this->call(OrderSeeder::class); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/Providers/AppServiceProvider.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | class CategoryFactory extends Factory 12 | { 13 | /** 14 | * Define the model's default state. 15 | * 16 | * @return array 17 | */ 18 | public function definition() 19 | { 20 | $name = $this->faker->sentence(2); 21 | $slug = Str::slug($name); 22 | 23 | return [ 24 | 'name' => $name, 25 | 'slug' => $slug, 26 | ]; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/Http/Controllers/DashboardSettingsProfileController.php: -------------------------------------------------------------------------------- 1 | validate([ 17 | 'name' => ['required', 'max:255', 'string'] 18 | ]); 19 | 20 | auth()->user()->update([ 21 | 'name' => $validated['name'] 22 | ]); 23 | 24 | return back()->with('message', 'You have updated your profile.'); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/Http/Controllers/WhishlistController.php: -------------------------------------------------------------------------------- 1 | Whishlist::getContent() 14 | ]); 15 | } 16 | 17 | public function toggle(Product $product) 18 | { 19 | Whishlist::toggle($product); 20 | } 21 | 22 | public function moveToCart(Product $product) 23 | { 24 | Whishlist::moveToCart($product); 25 | } 26 | 27 | public function destroy() 28 | { 29 | Whishlist::empty(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/Http/Controllers/DashboardOrderController.php: -------------------------------------------------------------------------------- 1 | where('user_id', auth()->id()) 16 | ->with('products', 'detail') 17 | ->withSortBy($request->sortBy ?? '') 18 | ->get() 19 | ); 20 | 21 | return inertia('Dashboard/Order', [ 22 | 'orders' => $orders 23 | ]); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /tests/Unit/PaymentTest.php: -------------------------------------------------------------------------------- 1 | create(); 18 | 19 | $this->assertInstanceOf(User::class, $payment->user); 20 | } 21 | 22 | public function test_payment_belongs_to_order() 23 | { 24 | $payment = Payment::factory()->create(); 25 | 26 | $this->assertInstanceOf(Order::class, $payment->order); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /database/factories/OrderFactory.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | class OrderFactory extends Factory 13 | { 14 | /** 15 | * Define the model's default state. 16 | * 17 | * @return array 18 | */ 19 | public function definition() 20 | { 21 | return [ 22 | 'user_id' => User::factory(), 23 | 'total' => 100, 24 | 'status' => 'Unpaid', 25 | 'stripe_session_id' => Str::random(20) 26 | ]; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lang/en/auth.php: -------------------------------------------------------------------------------- 1 | 'These credentials do not match our records.', 17 | 'password' => 'The provided password is incorrect.', 18 | 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', 19 | 20 | ]; 21 | -------------------------------------------------------------------------------- /resources/js/Layouts/ShopLayout.vue: -------------------------------------------------------------------------------- 1 | 5 | 6 | 23 | -------------------------------------------------------------------------------- /tests/Unit/OrderTest.php: -------------------------------------------------------------------------------- 1 | create(); 19 | 20 | $this->assertInstanceOf(User::class, $order->user); 21 | } 22 | 23 | public function test_order_belongs_to_many_products() 24 | { 25 | $order = Order::factory()->create(); 26 | 27 | $this->assertInstanceOf(Collection::class, $order->products); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/Providers/AuthServiceProvider.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | protected $policies = [ 16 | // 'App\Models\Model' => 'App\Policies\ModelPolicy', 17 | ]; 18 | 19 | /** 20 | * Register any authentication / authorization services. 21 | * 22 | * @return void 23 | */ 24 | public function boot() 25 | { 26 | $this->registerPolicies(); 27 | 28 | // 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrustProxies.php: -------------------------------------------------------------------------------- 1 | |string|null 14 | */ 15 | protected $proxies; 16 | 17 | /** 18 | * The headers that should be used to detect proxies. 19 | * 20 | * @var int 21 | */ 22 | protected $headers = 23 | Request::HEADER_X_FORWARDED_FOR | 24 | Request::HEADER_X_FORWARDED_HOST | 25 | Request::HEADER_X_FORWARDED_PORT | 26 | Request::HEADER_X_FORWARDED_PROTO | 27 | Request::HEADER_X_FORWARDED_AWS_ELB; 28 | } 29 | -------------------------------------------------------------------------------- /resources/js/Components/Pagination.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 25 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/EmailVerificationPromptController.php: -------------------------------------------------------------------------------- 1 | user()->hasVerifiedEmail() 21 | ? redirect()->intended(RouteServiceProvider::HOME) 22 | : Inertia::render('Auth/VerifyEmail', ['status' => session('status')]); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /resources/js/Components/Breeze/Checkbox.vue: -------------------------------------------------------------------------------- 1 | 26 | 27 | 34 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "dev": "vite", 5 | "build": "vite build" 6 | }, 7 | "devDependencies": { 8 | "@inertiajs/inertia": "^0.11.0", 9 | "@inertiajs/inertia-vue3": "^0.6.0", 10 | "@inertiajs/progress": "^0.2.7", 11 | "@tailwindcss/forms": "^0.5.3", 12 | "@vitejs/plugin-vue": "^3.0.0", 13 | "autoprefixer": "^10.4.12", 14 | "axios": "^1.1.2", 15 | "laravel-vite-plugin": "^0.6.0", 16 | "lodash": "^4.17.19", 17 | "postcss": "^8.4.18", 18 | "tailwindcss": "^3.2.1", 19 | "vite": "^3.0.0", 20 | "vue": "^3.2.41" 21 | }, 22 | "dependencies": { 23 | "chart.js": "^3.9.1", 24 | "dayjs": "^1.11.6", 25 | "vue-chartjs": "^4.1.2" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | command('inspire')->hourly(); 19 | } 20 | 21 | /** 22 | * Register the commands for the application. 23 | * 24 | * @return void 25 | */ 26 | protected function commands() 27 | { 28 | $this->load(__DIR__.'/Commands'); 29 | 30 | require base_path('routes/console.php'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lang/en/passwords.php: -------------------------------------------------------------------------------- 1 | 'Your password has been reset!', 17 | 'sent' => 'We have emailed your password reset link!', 18 | 'throttled' => 'Please wait before retrying.', 19 | 'token' => 'This password reset token is invalid.', 20 | 'user' => "We can't find a user with that email address.", 21 | 22 | ]; 23 | -------------------------------------------------------------------------------- /resources/js/Components/Breeze/NavLink.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 18 | -------------------------------------------------------------------------------- /database/factories/PaymentFactory.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | class PaymentFactory extends Factory 13 | { 14 | /** 15 | * Define the model's default state. 16 | * 17 | * @return array 18 | */ 19 | public function definition() 20 | { 21 | return [ 22 | 'user_id' => User::factory()->create(), 23 | 'order_id' => Order::factory()->create(), 24 | 'total_amount' => 100, 25 | 'status' => 'Pending', 26 | 'stripe_session_id' => random_bytes(32), 27 | 'type' => 'card' 28 | ]; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /database/seeders/CategorySeeder.php: -------------------------------------------------------------------------------- 1 | create(['name' => 'Sneakers']); 18 | Category::factory()->create(['name' => 'Boots']); 19 | Category::factory()->create(['name' => 'Shorts']); 20 | Category::factory()->create(['name' => 'Jeans']); 21 | Category::factory()->create(['name' => 'T-shirt']); 22 | Category::factory()->create(['name' => 'Hoodie']); 23 | Category::factory()->create(['name' => 'Sweatshirt']); 24 | Category::factory()->create(['name' => 'Hats']); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /resources/js/Components/ProductFilters/SortProducts.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | -------------------------------------------------------------------------------- /database/migrations/2022_11_07_203816_create_categories_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('name')->unique(); 19 | $table->string('slug'); 20 | $table->timestamps(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | * 27 | * @return void 28 | */ 29 | public function down() 30 | { 31 | Schema::dropIfExists('categories'); 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_100000_create_password_resets_table.php: -------------------------------------------------------------------------------- 1 | string('email')->index(); 18 | $table->string('token'); 19 | $table->timestamp('created_at')->nullable(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::dropIfExists('password_resets'); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /resources/js/Layouts/DashboardLayout.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 23 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/EmailVerificationNotificationController.php: -------------------------------------------------------------------------------- 1 | user()->hasVerifiedEmail()) { 20 | return redirect()->intended(RouteServiceProvider::HOME); 21 | } 22 | 23 | $request->user()->sendEmailVerificationNotification(); 24 | 25 | return back()->with('status', 'verification-link-sent'); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /resources/js/Components/Breeze/ResponsiveNavLink.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 18 | -------------------------------------------------------------------------------- /database/migrations/2022_11_21_153523_create_images_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->morphs('imageable'); 19 | $table->string('url'); 20 | $table->boolean('is_preview')->default(true); 21 | $table->timestamps(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | * 28 | * @return void 29 | */ 30 | public function down() 31 | { 32 | Schema::dropIfExists('images'); 33 | } 34 | }; 35 | -------------------------------------------------------------------------------- /database/migrations/2022_11_15_131105_create_whishlists_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->foreignId('user_id')->constrained()->cascadeOnDelete(); 19 | $table->foreignId('product_id')->constrained()->cascadeOnDelete(); 20 | $table->timestamps(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | * 27 | * @return void 28 | */ 29 | public function down() 30 | { 31 | Schema::dropIfExists('whishlists'); 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /tests/Feature/Auth/RegistrationTest.php: -------------------------------------------------------------------------------- 1 | get('/register'); 16 | 17 | $response->assertStatus(200); 18 | } 19 | 20 | public function test_new_users_can_register() 21 | { 22 | $response = $this->post('/register', [ 23 | 'name' => 'Test User', 24 | 'email' => 'test@example.com', 25 | 'password' => 'password', 26 | 'password_confirmation' => 'password', 27 | ]); 28 | 29 | $this->assertAuthenticated(); 30 | $response->assertRedirect(RouteServiceProvider::HOME); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tests/Feature/Order/OrderTest.php: -------------------------------------------------------------------------------- 1 | create()->first(); 20 | $this->actingAs($user); 21 | 22 | Category::factory()->create(); 23 | 24 | Product::factory()->create([ 25 | 'price' => '10.00', 26 | 'available_quantity' => 2 27 | ]); 28 | 29 | auth()->user()->cart()->attach(1, ['quantity' => 2]); 30 | } 31 | 32 | public function test_user_is_redirected_to_strie_checkout() 33 | { 34 | $this->post('/checkout') 35 | ->assertStatus(302); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/Http/Controllers/DashboardSettingsPasswordController.php: -------------------------------------------------------------------------------- 1 | validate([ 19 | 'current_password' => ['required', 'current_password'], 20 | 'password' => ['required', 'confirmed', Rules\Password::defaults()], 21 | 'password_confirmation' => ['required'] 22 | ]); 23 | 24 | auth()->user()->update([ 25 | 'password' => Hash::make($validated['password']) 26 | ]); 27 | 28 | return back()->with('message', 'You have updated your password.'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/Feature/Cart/CartTotalTest.php: -------------------------------------------------------------------------------- 1 | create(); 19 | 20 | $this->actingAs(User::factory()->create()); 21 | 22 | $product = Product::factory()->create(['price' => 20.10]); 23 | $product2 = Product::factory()->create(['price' => 40.60]); 24 | 25 | auth()->user()->cart()->attach($product->id, ['quantity' => 1]); 26 | auth()->user()->cart()->attach($product2->id, ['quantity' => 1]); 27 | 28 | $this->assertDatabaseCount('carts', 2); 29 | 30 | $this->assertEquals(60.70, Cart::getCartTotal(auth()->user()->cart)); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_000000_create_users_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('name'); 19 | $table->string('email')->unique(); 20 | $table->timestamp('email_verified_at')->nullable(); 21 | $table->string('password'); 22 | $table->rememberToken(); 23 | $table->timestamps(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('users'); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /database/migrations/2019_08_19_000000_create_failed_jobs_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('uuid')->unique(); 19 | $table->text('connection'); 20 | $table->text('queue'); 21 | $table->longText('payload'); 22 | $table->longText('exception'); 23 | $table->timestamp('failed_at')->useCurrent(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('failed_jobs'); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /config/cors.php: -------------------------------------------------------------------------------- 1 | [ 19 | 'api/*', 20 | 'sanctum/csrf-cookie', 21 | ], 22 | 23 | 'allowed_methods' => ['*'], 24 | 25 | 'allowed_origins' => ['*'], 26 | 27 | 'allowed_origins_patterns' => [], 28 | 29 | 'allowed_headers' => ['*'], 30 | 31 | 'exposed_headers' => [], 32 | 33 | 'max_age' => 0, 34 | 35 | 'supports_credentials' => false, 36 | 37 | ]; 38 | -------------------------------------------------------------------------------- /database/migrations/2022_11_08_220052_create_carts_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->foreignId('user_id')->constrained()->cascadeOnDelete(); 19 | $table->foreignId('product_id')->constrained()->cascadeOnDelete(); 20 | $table->unsignedInteger('quantity'); 21 | $table->boolean('saved_for_later')->default(false); 22 | $table->timestamps(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('carts'); 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /database/migrations/2022_11_14_215514_create_order_product_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->foreignId('order_id')->constrained()->cascadeOnDelete(); 19 | $table->foreignId('product_id')->constrained()->cascadeOnDelete(); 20 | $table->unsignedInteger('quantity'); 21 | $table->decimal('unit_price', 6, 2); 22 | $table->timestamps(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('order_product'); 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /app/Http/Middleware/RedirectIfAuthenticated.php: -------------------------------------------------------------------------------- 1 | check()) { 26 | return redirect(RouteServiceProvider::HOME); 27 | } 28 | } 29 | 30 | return $next($request); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /database/factories/ProductFactory.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | class ProductFactory extends Factory 13 | { 14 | /** 15 | * Define the model's default state. 16 | * 17 | * @return array 18 | */ 19 | public function definition() 20 | { 21 | $name = $this->faker->sentence(2); 22 | $slug = Str::slug($name); 23 | 24 | return [ 25 | 'category_id' => Category::all()->random()->id, 26 | 'name' => $name, 27 | 'slug' => $slug, 28 | 'description' => $this->faker->paragraph(3), 29 | 'price' => $this->faker->randomElement(['10.99', '20.10', '29.99', '10.00', '39.90']), 30 | 'available_quantity' => $this->faker->randomElement([1, 2, 3, 4, 5]), 31 | ]; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /database/migrations/2022_11_14_212721_create_orders_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->foreignId('user_id')->nullable()->constrained()->nullOnDelete(); 19 | $table->enum('status', ['Unpaid', 'Paid', 'Shipped', 'Completed', 'Canceled']); 20 | $table->decimal('total', 6, 2); 21 | $table->string('stripe_session_id')->unique(); 22 | $table->timestamps(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('orders'); 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/VerifyEmailController.php: -------------------------------------------------------------------------------- 1 | user()->hasVerifiedEmail()) { 21 | return redirect()->intended(RouteServiceProvider::HOME.'?verified=1'); 22 | } 23 | 24 | if ($request->user()->markEmailAsVerified()) { 25 | event(new Verified($request->user())); 26 | } 27 | 28 | return redirect()->intended(RouteServiceProvider::HOME.'?verified=1'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /resources/js/Components/ShopNavbar/TheWhishlist.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | -------------------------------------------------------------------------------- /database/migrations/2022_11_07_210742_create_products_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->foreignId('category_id')->constrained()->cascadeOnDelete(); 19 | $table->string('name')->unique(); 20 | $table->string('slug'); 21 | $table->text('description'); 22 | $table->decimal('price', 6, 2); 23 | $table->unsignedInteger('available_quantity'); 24 | $table->timestamps(); 25 | }); 26 | } 27 | 28 | /** 29 | * Reverse the migrations. 30 | * 31 | * @return void 32 | */ 33 | public function down() 34 | { 35 | Schema::dropIfExists('products'); 36 | } 37 | }; 38 | -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- 1 | const defaultTheme = require('tailwindcss/defaultTheme'); 2 | 3 | /** @type {import('tailwindcss').Config} */ 4 | module.exports = { 5 | content: [ 6 | './vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php', 7 | './storage/framework/views/*.php', 8 | './resources/views/**/*.blade.php', 9 | './resources/js/**/*.vue', 10 | ], 11 | 12 | theme: { 13 | extend: { 14 | colors: { 15 | 'c-green-100': 'rgb(162, 209, 146)', 16 | 'c-green-300': 'rgb(101, 147, 87)', 17 | 'c-green-400': 'rgb(99, 145, 85)', 18 | 'c-green-500': 'rgb(90, 132, 78)', 19 | 'c-green-600': 'rgb(84, 122, 74)', 20 | 'c-green-700': 'rgb(80, 112, 72)' 21 | }, 22 | fontSize: { 23 | 'xxs': '11px' 24 | }, 25 | animation: { 26 | 'spin-fast': 'spin 300ms linear infinite', 27 | } 28 | }, 29 | }, 30 | 31 | plugins: [require('@tailwindcss/forms')], 32 | }; 33 | -------------------------------------------------------------------------------- /resources/js/Components/FlashErrorMessage.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | -------------------------------------------------------------------------------- /database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->morphs('tokenable'); 19 | $table->string('name'); 20 | $table->string('token', 64)->unique(); 21 | $table->text('abilities')->nullable(); 22 | $table->timestamp('last_used_at')->nullable(); 23 | $table->timestamp('expires_at')->nullable(); 24 | $table->timestamps(); 25 | }); 26 | } 27 | 28 | /** 29 | * Reverse the migrations. 30 | * 31 | * @return void 32 | */ 33 | public function down() 34 | { 35 | Schema::dropIfExists('personal_access_tokens'); 36 | } 37 | }; 38 | -------------------------------------------------------------------------------- /config/services.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'domain' => env('MAILGUN_DOMAIN'), 19 | 'secret' => env('MAILGUN_SECRET'), 20 | 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), 21 | 'scheme' => 'https', 22 | ], 23 | 24 | 'postmark' => [ 25 | 'token' => env('POSTMARK_TOKEN'), 26 | ], 27 | 28 | 'ses' => [ 29 | 'key' => env('AWS_ACCESS_KEY_ID'), 30 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 31 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 32 | ], 33 | 34 | ]; 35 | -------------------------------------------------------------------------------- /app/Providers/EventServiceProvider.php: -------------------------------------------------------------------------------- 1 | > 16 | */ 17 | protected $listen = [ 18 | Registered::class => [ 19 | SendEmailVerificationNotification::class, 20 | ], 21 | ]; 22 | 23 | /** 24 | * Register any events for your application. 25 | * 26 | * @return void 27 | */ 28 | public function boot() 29 | { 30 | // 31 | } 32 | 33 | /** 34 | * Determine if events and listeners should be automatically discovered. 35 | * 36 | * @return bool 37 | */ 38 | public function shouldDiscoverEvents() 39 | { 40 | return false; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /tests/Unit/UserTest.php: -------------------------------------------------------------------------------- 1 | create(); 17 | 18 | $this->assertInstanceOf(Collection::class, $user->cart); 19 | } 20 | 21 | public function test_user_has_many_whishlist_items() 22 | { 23 | $user = User::factory()->create(); 24 | 25 | $this->assertInstanceOf(Collection::class, $user->whishlist); 26 | } 27 | 28 | public function test_user_can_make_many_orders() 29 | { 30 | $user = User::factory()->create(); 31 | 32 | $this->assertInstanceOf(Collection::class, $user->orders); 33 | } 34 | 35 | public function test_user_can_make_many_payments() 36 | { 37 | $user = User::factory()->create(); 38 | 39 | $this->assertInstanceOf(Collection::class, $user->payments); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /database/migrations/2022_11_16_121317_create_payments_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->foreignId('user_id')->nullable()->constrained()->nullOnDelete(); 19 | $table->foreignId('order_id')->constrained()->cascadeOnDelete(); 20 | $table->decimal('total_amount', 6, 2); 21 | $table->enum('status', ['Pending', 'Paid', 'Failed']); 22 | $table->string('stripe_session_id'); 23 | $table->string('type'); 24 | $table->timestamps(); 25 | }); 26 | } 27 | 28 | /** 29 | * Reverse the migrations. 30 | * 31 | * @return void 32 | */ 33 | public function down() 34 | { 35 | Schema::dropIfExists('payments'); 36 | } 37 | }; 38 | -------------------------------------------------------------------------------- /resources/js/Components/FlashMessage.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | -------------------------------------------------------------------------------- /database/factories/UserFactory.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | class UserFactory extends Factory 12 | { 13 | /** 14 | * Define the model's default state. 15 | * 16 | * @return array 17 | */ 18 | public function definition() 19 | { 20 | return [ 21 | 'name' => fake()->name(), 22 | 'email' => fake()->unique()->safeEmail(), 23 | 'email_verified_at' => now(), 24 | 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password 25 | 'remember_token' => Str::random(10), 26 | ]; 27 | } 28 | 29 | /** 30 | * Indicate that the model's email address should be unverified. 31 | * 32 | * @return static 33 | */ 34 | public function unverified() 35 | { 36 | return $this->state(fn (array $attributes) => [ 37 | 'email_verified_at' => null, 38 | ]); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tests/Unit/ProductTest.php: -------------------------------------------------------------------------------- 1 | create(); 21 | } 22 | 23 | public function test_a_product_belongs_to_a_category() 24 | { 25 | $product = Product::factory()->create(); 26 | 27 | $this->assertInstanceOf(Category::class, $product->category); 28 | } 29 | 30 | public function test_product_belongs_to_many_orders() 31 | { 32 | $product = Product::factory()->create(); 33 | 34 | $this->assertInstanceOf(Collection::class, $product->orders); 35 | } 36 | 37 | public function test_product_has_many_images() 38 | { 39 | $product = Product::factory()->create(); 40 | 41 | $this->assertInstanceOf(Collection::class, $product->images); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /resources/js/app.js: -------------------------------------------------------------------------------- 1 | import './bootstrap'; 2 | import '../css/app.css'; 3 | 4 | import { createApp, h } from 'vue'; 5 | import { createInertiaApp, Link, Head } from '@inertiajs/inertia-vue3'; 6 | import { InertiaProgress } from '@inertiajs/progress'; 7 | import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers'; 8 | import { ZiggyVue } from '../../vendor/tightenco/ziggy/dist/vue.m'; 9 | import dayjs from 'dayjs' 10 | 11 | const appName = window.document.getElementsByTagName('title')[0]?.innerText || 'Laravel'; 12 | 13 | createInertiaApp({ 14 | title: (title) => `${title} - ${appName}`, 15 | resolve: (name) => resolvePageComponent(`./Pages/${name}.vue`, import.meta.glob('./Pages/**/*.vue')), 16 | setup({ el, app, props, plugin }) { 17 | const VueApp = createApp({ render: () => h(app, props) }); 18 | 19 | VueApp.config.globalProperties.$date = dayjs; 20 | 21 | VueApp.use(plugin) 22 | .use(ZiggyVue, Ziggy) 23 | .component('Link', Link) 24 | .component('Head', Head) 25 | .mount(el); 26 | }, 27 | }); 28 | 29 | InertiaProgress.init({ 30 | color: 'rgb(141, 206, 121)', 31 | showSpinner: false 32 | }); -------------------------------------------------------------------------------- /config/view.php: -------------------------------------------------------------------------------- 1 | [ 17 | resource_path('views'), 18 | ], 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Compiled View Path 23 | |-------------------------------------------------------------------------- 24 | | 25 | | This option determines where all the compiled Blade templates will be 26 | | stored for your application. Typically, this is within the storage 27 | | directory. However, as usual, you are free to change this value. 28 | | 29 | */ 30 | 31 | 'compiled' => env( 32 | 'VIEW_COMPILED_PATH', 33 | realpath(storage_path('framework/views')) 34 | ), 35 | 36 | ]; 37 | -------------------------------------------------------------------------------- /tests/Feature/Dashboard/DashboardSettingsProfileTest.php: -------------------------------------------------------------------------------- 1 | create(['name' => 'test']); 17 | $this->actingAs($user); 18 | 19 | $response = $this->get('/dashboard/settings/profile'); 20 | 21 | $response 22 | ->assertInertia(function (AssertableInertia $page) { 23 | $page 24 | ->component('Dashboard/Settings/Profile'); 25 | }); 26 | } 27 | 28 | public function test_user_can_update_his_name(): void 29 | { 30 | $user = User::factory()->create(['name' => 'test']); 31 | $this->actingAs($user); 32 | 33 | $this->patch('/dashboard/settings/profile', [ 34 | 'name' => 'updated' 35 | ]); 36 | 37 | $this->assertEquals('updated', $user->fresh()->name); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /tests/Feature/Product/ShowProductTest.php: -------------------------------------------------------------------------------- 1 | create(); 18 | 19 | $product = Product::factory()->create(); 20 | 21 | $response = $this->get("/products/$product->slug"); 22 | 23 | $response 24 | ->assertInertia(function (AssertableInertia $page) use ($product) { 25 | $page 26 | ->component('Product/Show') 27 | ->has('product', function (AssertableInertia $page) use ($product) { 28 | $page 29 | ->where('id', $product->id) 30 | ->where('name', $product->name) 31 | // ->where('name', $product->name) check altri category.name ecc 32 | ->etc(); 33 | }); 34 | }); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tests/Feature/Auth/AuthenticationTest.php: -------------------------------------------------------------------------------- 1 | get('/login'); 17 | 18 | $response->assertStatus(200); 19 | } 20 | 21 | public function test_users_can_authenticate_using_the_login_screen() 22 | { 23 | $user = User::factory()->create(); 24 | 25 | $response = $this->post('/login', [ 26 | 'email' => $user->email, 27 | 'password' => 'password', 28 | ]); 29 | 30 | $this->assertAuthenticated(); 31 | $response->assertRedirect(RouteServiceProvider::HOME); 32 | } 33 | 34 | public function test_users_can_not_authenticate_with_invalid_password() 35 | { 36 | $user = User::factory()->create(); 37 | 38 | $this->post('/login', [ 39 | 'email' => $user->email, 40 | 'password' => 'wrong-password', 41 | ]); 42 | 43 | $this->assertGuest(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /app/Exceptions/Handler.php: -------------------------------------------------------------------------------- 1 | , \Psr\Log\LogLevel::*> 14 | */ 15 | protected $levels = [ 16 | // 17 | ]; 18 | 19 | /** 20 | * A list of the exception types that are not reported. 21 | * 22 | * @var array> 23 | */ 24 | protected $dontReport = [ 25 | // 26 | ]; 27 | 28 | /** 29 | * A list of the inputs that are never flashed to the session on validation exceptions. 30 | * 31 | * @var array 32 | */ 33 | protected $dontFlash = [ 34 | 'current_password', 35 | 'password', 36 | 'password_confirmation', 37 | ]; 38 | 39 | /** 40 | * Register the exception handling callbacks for the application. 41 | * 42 | * @return void 43 | */ 44 | public function register() 45 | { 46 | $this->reportable(function (Throwable $e) { 47 | // 48 | }); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | ./tests/Unit 10 | 11 | 12 | ./tests/Feature 13 | 14 | 15 | 16 | 17 | ./app 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /tests/Feature/Auth/PasswordConfirmationTest.php: -------------------------------------------------------------------------------- 1 | create(); 16 | 17 | $response = $this->actingAs($user)->get('/confirm-password'); 18 | 19 | $response->assertStatus(200); 20 | } 21 | 22 | public function test_password_can_be_confirmed() 23 | { 24 | $user = User::factory()->create(); 25 | 26 | $response = $this->actingAs($user)->post('/confirm-password', [ 27 | 'password' => 'password', 28 | ]); 29 | 30 | $response->assertRedirect(); 31 | $response->assertSessionHasNoErrors(); 32 | } 33 | 34 | public function test_password_is_not_confirmed_with_invalid_password() 35 | { 36 | $user = User::factory()->create(); 37 | 38 | $response = $this->actingAs($user)->post('/confirm-password', [ 39 | 'password' => 'wrong-password', 40 | ]); 41 | 42 | $response->assertSessionHasErrors(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /database/migrations/2022_11_14_220913_create_order_details_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->foreignId('order_id')->constrained()->cascadeOnDelete(); 19 | $table->string('customer_name'); 20 | $table->string('customer_email'); 21 | $table->string('customer_phone')->nullable(); 22 | $table->string('country'); 23 | $table->string('city'); 24 | $table->string('postalcode'); 25 | $table->string('province')->nullable(); 26 | $table->string('address1'); 27 | $table->string('address2')->nullable(); 28 | $table->timestamps(); 29 | }); 30 | } 31 | 32 | /** 33 | * Reverse the migrations. 34 | * 35 | * @return void 36 | */ 37 | public function down() 38 | { 39 | Schema::dropIfExists('order_details'); 40 | } 41 | }; 42 | -------------------------------------------------------------------------------- /resources/js/Components/ShopNavbar.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 30 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | APP_NAME=Laravel 2 | APP_ENV=local 3 | APP_KEY= 4 | APP_DEBUG=true 5 | APP_URL=http://localhost 6 | 7 | LOG_CHANNEL=stack 8 | LOG_DEPRECATIONS_CHANNEL=null 9 | LOG_LEVEL=debug 10 | 11 | DB_CONNECTION=mysql 12 | DB_HOST=127.0.0.1 13 | DB_PORT=3306 14 | DB_DATABASE=laravel 15 | DB_USERNAME=root 16 | DB_PASSWORD= 17 | 18 | BROADCAST_DRIVER=log 19 | CACHE_DRIVER=file 20 | FILESYSTEM_DISK=local 21 | QUEUE_CONNECTION=sync 22 | SESSION_DRIVER=file 23 | SESSION_LIFETIME=120 24 | 25 | MEMCACHED_HOST=127.0.0.1 26 | 27 | REDIS_HOST=127.0.0.1 28 | REDIS_PASSWORD=null 29 | REDIS_PORT=6379 30 | 31 | MAIL_MAILER=smtp 32 | MAIL_HOST=mailhog 33 | MAIL_PORT=1025 34 | MAIL_USERNAME=null 35 | MAIL_PASSWORD=null 36 | MAIL_ENCRYPTION=null 37 | MAIL_FROM_ADDRESS="hello@example.com" 38 | MAIL_FROM_NAME="${APP_NAME}" 39 | 40 | AWS_ACCESS_KEY_ID= 41 | AWS_SECRET_ACCESS_KEY= 42 | AWS_DEFAULT_REGION=us-east-1 43 | AWS_BUCKET= 44 | AWS_USE_PATH_STYLE_ENDPOINT=false 45 | 46 | PUSHER_APP_ID= 47 | PUSHER_APP_KEY= 48 | PUSHER_APP_SECRET= 49 | PUSHER_HOST= 50 | PUSHER_PORT=443 51 | PUSHER_SCHEME=https 52 | PUSHER_APP_CLUSTER=mt1 53 | 54 | VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}" 55 | VITE_PUSHER_HOST="${PUSHER_HOST}" 56 | VITE_PUSHER_PORT="${PUSHER_PORT}" 57 | VITE_PUSHER_SCHEME="${PUSHER_SCHEME}" 58 | VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" 59 | -------------------------------------------------------------------------------- /app/Models/Cart.php: -------------------------------------------------------------------------------- 1 | 'boolean' 14 | ]; 15 | 16 | /** 17 | * @param ?string $instance 18 | */ 19 | public static function getContent($instance = null) 20 | { 21 | if ($instance && $instance === 'saved') { 22 | return auth()->user()->cart() 23 | ->where('saved_for_later', true) 24 | ->get(); 25 | } 26 | 27 | return auth()->user()->cart() 28 | ->where('saved_for_later', false) 29 | ->get(); 30 | } 31 | 32 | /** 33 | * @param int $id 34 | */ 35 | public static function getCartTotal($products) 36 | { 37 | $total = "0.00"; 38 | 39 | foreach ($products as $item) { 40 | $total += $item->price * $item->pivot->quantity; 41 | } 42 | 43 | return number_format($total, 2); 44 | } 45 | 46 | public static function empty() 47 | { 48 | $ids = Cart::getContent(); 49 | 50 | auth()->user()->cart() 51 | ->detach($ids->pluck('id')); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/ConfirmablePasswordController.php: -------------------------------------------------------------------------------- 1 | validate([ 33 | 'email' => $request->user()->email, 34 | 'password' => $request->password, 35 | ])) { 36 | throw ValidationException::withMessages([ 37 | 'password' => __('auth.password'), 38 | ]); 39 | } 40 | 41 | $request->session()->put('auth.password_confirmed_at', time()); 42 | 43 | return redirect()->intended(RouteServiceProvider::HOME); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /app/Models/Whishlist.php: -------------------------------------------------------------------------------- 1 | user()->whishlist() 19 | ->wherePivot('product_id', $product->id) 20 | ->first(); 21 | 22 | if (!$productInWhishlist) { 23 | auth()->user()->whishlist()->attach($product->id); 24 | } else { 25 | auth()->user()->whishlist()->detach($product->id); 26 | } 27 | } 28 | 29 | public static function getContent(): Collection 30 | { 31 | return auth()->user()->whishlist; 32 | } 33 | 34 | /** 35 | * @param Product $product 36 | * @return void 37 | */ 38 | public static function moveToCart(Product $product): void 39 | { 40 | auth()->user()->cart()->attach($product->id, ['quantity' => 1]); 41 | auth()->user()->whishlist()->detach($product->id); 42 | } 43 | 44 | public static function empty(): void 45 | { 46 | auth()->user()->whishlist()->detach(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /resources/js/bootstrap.js: -------------------------------------------------------------------------------- 1 | import _ from 'lodash'; 2 | window._ = _; 3 | 4 | /** 5 | * We'll load the axios HTTP library which allows us to easily issue requests 6 | * to our Laravel back-end. This library automatically handles sending the 7 | * CSRF token as a header based on the value of the "XSRF" token cookie. 8 | */ 9 | 10 | import axios from 'axios'; 11 | window.axios = axios; 12 | 13 | window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 14 | 15 | /** 16 | * Echo exposes an expressive API for subscribing to channels and listening 17 | * for events that are broadcast by Laravel. Echo and event broadcasting 18 | * allows your team to easily build robust real-time web applications. 19 | */ 20 | 21 | // import Echo from 'laravel-echo'; 22 | 23 | // import Pusher from 'pusher-js'; 24 | // window.Pusher = Pusher; 25 | 26 | // window.Echo = new Echo({ 27 | // broadcaster: 'pusher', 28 | // key: import.meta.env.VITE_PUSHER_APP_KEY, 29 | // wsHost: import.meta.env.VITE_PUSHER_HOST ? import.meta.env.VITE_PUSHER_HOST : `ws-${import.meta.env.VITE_PUSHER_APP_CLUSTER}.pusher.com`, 30 | // wsPort: import.meta.env.VITE_PUSHER_PORT ?? 80, 31 | // wssPort: import.meta.env.VITE_PUSHER_PORT ?? 443, 32 | // forceTLS: (import.meta.env.VITE_PUSHER_SCHEME ?? 'https') === 'https', 33 | // enabledTransports: ['ws', 'wss'], 34 | // }); 35 | -------------------------------------------------------------------------------- /resources/views/app.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | {{ config('app.name', 'Laravel') }} 9 | 10 | 11 | @routes 12 | @vite(['resources/js/app.js', "resources/js/Pages/{$page['component']}.vue"]) 13 | @inertiaHead 14 | 15 | 48 | 49 | 50 | 51 | @inertia 52 | 53 | 54 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ecommerce app 2 | Ecommerce built using laravel 9, vue 3, inertia.js and stripe to make payments. 3 | I developed the project using a TDD approach.
4 | 5 | ## DB structure 6 | ![Db-structure](public/demo/DB_structure.png) 7 | 8 | ## Shop 9 | Each user can view the products for sale and apply filters on them.
10 | It is possible to search for a product by name, filter the results by category or by price, all without refreshing the page.
11 | It is also possible to sort the results by price or by "best sellers". 12 | 13 | https://user-images.githubusercontent.com/116803143/204110439-dc42cc84-8290-4747-94d0-bf92fe011930.mp4 14 | 15 | Once logged in, the user can add the products to his cart, or save them in his whishlist. 16 | When the user clicks the payment button, he is redirected to the payment page provided by stripe.
When the user enters his data and makes the payment, he is redirected to a purchase confirmation page. 17 | 18 | https://user-images.githubusercontent.com/116803143/204110446-5cc65243-042c-4b8c-87e4-f37e233d4e54.mp4 19 | 20 | ## User Dashboard 21 | From the dashboard a registered user can summarize his purchases, view how many orders he has placed in a period of time, how much he has spent on average, etc. 22 | He can also view his orders in detail and update his profile information (username and password). 23 | 24 | https://user-images.githubusercontent.com/116803143/204110452-fc9c5f6c-9a4d-4688-98d3-e59fea92cedb.mp4 25 | -------------------------------------------------------------------------------- /app/Http/Controllers/ShopController.php: -------------------------------------------------------------------------------- 1 | withCategories($request->category ?? '') 19 | ->withMinPrice($request->min_price ?? '') 20 | ->withMaxPrice($request->max_price ?? '') 21 | ->withSearch($request->search ?? '') 22 | ->withSortBy($request->sortBy ?? '') 23 | ->with('category') 24 | ->where('available_quantity', '>', 0) 25 | ->paginate(8) 26 | ->withQueryString() 27 | ); 28 | 29 | $categories = CategoryResource::collection(Category::withCount('products')->get()); 30 | 31 | return inertia('Shop', [ 32 | 'products' => $products, 33 | 'categories' => $categories, 34 | 'category' => $request->category ?? '', 35 | 'min_price' => $request->min_price ?? '', 36 | 'max_price' => $request->max_price ?? '', 37 | 'sortBy' => $request->sortBy ?? '', 38 | 'search' => $request->search 39 | ]); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/Models/User.php: -------------------------------------------------------------------------------- 1 | 20 | */ 21 | protected $hidden = [ 22 | 'password', 23 | 'remember_token', 24 | ]; 25 | 26 | /** 27 | * The attributes that should be cast. 28 | * 29 | * @var array 30 | */ 31 | protected $casts = [ 32 | 'email_verified_at' => 'datetime', 33 | ]; 34 | 35 | public function cart() 36 | { 37 | return $this->belongsToMany(Product::class, 'carts') 38 | ->withPivot(['quantity', 'saved_for_later']) 39 | ->withTimestamps() 40 | ->using(Cart::class); 41 | } 42 | 43 | public function whishlist() 44 | { 45 | return $this->belongsToMany(Product::class, 'whishlists') 46 | ->withTimestamps() 47 | ->using(Whishlist::class); 48 | } 49 | 50 | public function orders() 51 | { 52 | return $this->hasMany(Order::class); 53 | } 54 | 55 | public function payments() 56 | { 57 | return $this->hasMany(Payment::class); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | configureRateLimiting(); 30 | 31 | $this->routes(function () { 32 | Route::middleware('api') 33 | ->prefix('api') 34 | ->group(base_path('routes/api.php')); 35 | 36 | Route::middleware('web') 37 | ->group(base_path('routes/web.php')); 38 | }); 39 | } 40 | 41 | /** 42 | * Configure the rate limiters for the application. 43 | * 44 | * @return void 45 | */ 46 | protected function configureRateLimiting() 47 | { 48 | RateLimiter::for('api', function (Request $request) { 49 | return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()); 50 | }); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/RegisteredUserController.php: -------------------------------------------------------------------------------- 1 | validate([ 38 | 'name' => 'required|string|max:255', 39 | 'email' => 'required|string|email|max:255|unique:users', 40 | 'password' => ['required', 'confirmed', Rules\Password::defaults()], 41 | ]); 42 | 43 | $user = User::create([ 44 | 'name' => $request->name, 45 | 'email' => $request->email, 46 | 'password' => Hash::make($request->password), 47 | ]); 48 | 49 | event(new Registered($user)); 50 | 51 | Auth::login($user); 52 | 53 | return redirect(RouteServiceProvider::HOME); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /tests/Feature/ShopTest.php: -------------------------------------------------------------------------------- 1 | create(); 20 | } 21 | 22 | public function test_return_all_products_whose_available_quantity_is_above_0(): void 23 | { 24 | Product::factory(2)->create(); 25 | Product::factory()->create(['available_quantity' => 0]); 26 | 27 | $response = $this->get('/shop'); 28 | 29 | $response 30 | ->assertInertia(function (AssertableInertia $page) { 31 | $page 32 | ->component('Shop') 33 | ->has('products.data', 2) 34 | ->has('products.data.0', function (AssertableInertia $page) { 35 | $page 36 | ->where('id', Product::first()->id) 37 | ->etc(); 38 | }); 39 | }); 40 | } 41 | 42 | public function test_return_all_categories() 43 | { 44 | Product::factory(2)->create(); 45 | 46 | $response = $this->get('/shop'); 47 | 48 | $response 49 | ->assertStatus(200) 50 | ->assertInertia(function (AssertableInertia $page) { 51 | $page 52 | ->has('products.data', 2) 53 | ->has('categories', 1); 54 | }); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /resources/js/Components/ProductFilters/ProductSearch.vue: -------------------------------------------------------------------------------- 1 | 18 | 19 | 48 | -------------------------------------------------------------------------------- /resources/js/Components/Dashboard/DashboardNavbar.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 34 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/AuthenticatedSessionController.php: -------------------------------------------------------------------------------- 1 | Route::has('password.request'), 24 | 'status' => session('status'), 25 | ]); 26 | } 27 | 28 | /** 29 | * Handle an incoming authentication request. 30 | * 31 | * @param \App\Http\Requests\Auth\LoginRequest $request 32 | * @return \Illuminate\Http\RedirectResponse 33 | */ 34 | public function store(LoginRequest $request) 35 | { 36 | $request->authenticate(); 37 | 38 | $request->session()->regenerate(); 39 | 40 | return redirect()->intended(RouteServiceProvider::HOME); 41 | } 42 | 43 | /** 44 | * Destroy an authenticated session. 45 | * 46 | * @param \Illuminate\Http\Request $request 47 | * @return \Illuminate\Http\RedirectResponse 48 | */ 49 | public function destroy(Request $request) 50 | { 51 | Auth::guard('web')->logout(); 52 | 53 | $request->session()->invalidate(); 54 | 55 | $request->session()->regenerateToken(); 56 | 57 | return redirect('/shop'); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/PasswordResetLinkController.php: -------------------------------------------------------------------------------- 1 | session('status'), 22 | ]); 23 | } 24 | 25 | /** 26 | * Handle an incoming password reset link request. 27 | * 28 | * @param \Illuminate\Http\Request $request 29 | * @return \Illuminate\Http\RedirectResponse 30 | * 31 | * @throws \Illuminate\Validation\ValidationException 32 | */ 33 | public function store(Request $request) 34 | { 35 | $request->validate([ 36 | 'email' => 'required|email', 37 | ]); 38 | 39 | // We will send the password reset link to this user. Once we have attempted 40 | // to send the link, we will examine the response then see the message we 41 | // need to show to the user. Finally, we'll send out a proper response. 42 | $status = Password::sendResetLink( 43 | $request->only('email') 44 | ); 45 | 46 | if ($status == Password::RESET_LINK_SENT) { 47 | return back()->with('status', __($status)); 48 | } 49 | 50 | throw ValidationException::withMessages([ 51 | 'email' => [trans($status)], 52 | ]); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /config/hashing.php: -------------------------------------------------------------------------------- 1 | 'bcrypt', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Bcrypt Options 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may specify the configuration options that should be used when 26 | | passwords are hashed using the Bcrypt algorithm. This will allow you 27 | | to control the amount of time it takes to hash the given password. 28 | | 29 | */ 30 | 31 | 'bcrypt' => [ 32 | 'rounds' => env('BCRYPT_ROUNDS', 10), 33 | ], 34 | 35 | /* 36 | |-------------------------------------------------------------------------- 37 | | Argon Options 38 | |-------------------------------------------------------------------------- 39 | | 40 | | Here you may specify the configuration options that should be used when 41 | | passwords are hashed using the Argon algorithm. These will allow you 42 | | to control the amount of time it takes to hash the given password. 43 | | 44 | */ 45 | 46 | 'argon' => [ 47 | 'memory' => 65536, 48 | 'threads' => 1, 49 | 'time' => 4, 50 | ], 51 | 52 | ]; 53 | -------------------------------------------------------------------------------- /resources/js/Components/Dashboard/Bar.vue: -------------------------------------------------------------------------------- 1 | 69 | 70 | -------------------------------------------------------------------------------- /bootstrap/app.php: -------------------------------------------------------------------------------- 1 | singleton( 30 | Illuminate\Contracts\Http\Kernel::class, 31 | App\Http\Kernel::class 32 | ); 33 | 34 | $app->singleton( 35 | Illuminate\Contracts\Console\Kernel::class, 36 | App\Console\Kernel::class 37 | ); 38 | 39 | $app->singleton( 40 | Illuminate\Contracts\Debug\ExceptionHandler::class, 41 | App\Exceptions\Handler::class 42 | ); 43 | 44 | /* 45 | |-------------------------------------------------------------------------- 46 | | Return The Application 47 | |-------------------------------------------------------------------------- 48 | | 49 | | This script returns the application instance. The instance is given to 50 | | the calling script so we can separate the building of the instances 51 | | from the actual running of the application and sending responses. 52 | | 53 | */ 54 | 55 | return $app; 56 | -------------------------------------------------------------------------------- /app/Http/Middleware/HandleInertiaRequests.php: -------------------------------------------------------------------------------- 1 | ['user' => $request->user(),], 41 | 42 | // Return only the products that are not in the saved for later list 43 | 'cart' => auth()->user() ? Cart::getContent() : [], 44 | 45 | // Return only the count 46 | 'whishlist' => auth()->user() ? Whishlist::getContent() : [], 47 | 48 | // Flash messages 49 | 'flash' => [ 50 | 'message' => fn () => $request->session()->get('message'), 51 | 'error' => fn () => $request->session()->get('error'), 52 | ], 53 | 54 | 'ziggy' => function () use ($request) { 55 | return array_merge((new Ziggy)->toArray(), [ 56 | 'location' => $request->url(), 57 | ]); 58 | }, 59 | ]); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /artisan: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | make(Illuminate\Contracts\Console\Kernel::class); 34 | 35 | $status = $kernel->handle( 36 | $input = new Symfony\Component\Console\Input\ArgvInput, 37 | new Symfony\Component\Console\Output\ConsoleOutput 38 | ); 39 | 40 | /* 41 | |-------------------------------------------------------------------------- 42 | | Shutdown The Application 43 | |-------------------------------------------------------------------------- 44 | | 45 | | Once Artisan has finished running, we will fire off the shutdown events 46 | | so that any final work may be done by the application before we shut 47 | | down the process. This is the last thing to happen to the request. 48 | | 49 | */ 50 | 51 | $kernel->terminate($input, $status); 52 | 53 | exit($status); 54 | -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class); 50 | 51 | $response = $kernel->handle( 52 | $request = Request::capture() 53 | )->send(); 54 | 55 | $kernel->terminate($request, $response); 56 | -------------------------------------------------------------------------------- /resources/js/Pages/Auth/ConfirmPassword.vue: -------------------------------------------------------------------------------- 1 | 19 | 20 | 56 | -------------------------------------------------------------------------------- /database/seeders/ProductSeeder.php: -------------------------------------------------------------------------------- 1 | create(['category_id' => 1]); 19 | $boots = Product::factory(2)->create(['category_id' => 2]); 20 | $shorts = Product::factory(1)->create(['category_id' => 3]); 21 | $jeans = Product::factory(4)->create(['category_id' => 4]); 22 | $shirts = Product::factory(2)->create(['category_id' => 5]); 23 | $hoodies = Product::factory(2)->create(['category_id' => 6]); 24 | $sweatshirts = Product::factory(4)->create(['category_id' => 7]); 25 | $hats = Product::factory(5)->create(['category_id' => 8]); 26 | 27 | foreach ($shirts as $shirt) { 28 | $shirt->images()->create(['url' => 'green-shirt.jpg']); 29 | } 30 | 31 | foreach ($sneakers as $sneaker) { 32 | $sneaker->images()->create(['url' => 'sneaker.jpg']); 33 | } 34 | 35 | foreach ($boots as $boot) { 36 | $boot->images()->create(['url' => 'boot.jpg']); 37 | } 38 | 39 | foreach ($shorts as $short) { 40 | $short->images()->create(['url' => 'short.jpg']); 41 | } 42 | 43 | foreach ($jeans as $j) { 44 | $j->images()->create(['url' => 'jeans.jpg']); 45 | } 46 | 47 | foreach ($hoodies as $hoodie) { 48 | $hoodie->images()->create(['url' => 'hoodie.jpg']); 49 | } 50 | 51 | foreach ($sweatshirts as $sweatshirt) { 52 | $sweatshirt->images()->create(['url' => 'sweatshirt.jpg']); 53 | } 54 | 55 | foreach ($hats as $hat) { 56 | $hat->images()->create(['url' => 'hat.jpg']); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /resources/js/Pages/Auth/VerifyEmail.vue: -------------------------------------------------------------------------------- 1 | 21 | 22 | 60 | -------------------------------------------------------------------------------- /tests/Feature/Auth/EmailVerificationTest.php: -------------------------------------------------------------------------------- 1 | create([ 20 | 'email_verified_at' => null, 21 | ]); 22 | 23 | $response = $this->actingAs($user)->get('/verify-email'); 24 | 25 | $response->assertStatus(200); 26 | } 27 | 28 | public function test_email_can_be_verified() 29 | { 30 | $user = User::factory()->create([ 31 | 'email_verified_at' => null, 32 | ]); 33 | 34 | Event::fake(); 35 | 36 | $verificationUrl = URL::temporarySignedRoute( 37 | 'verification.verify', 38 | now()->addMinutes(60), 39 | ['id' => $user->id, 'hash' => sha1($user->email)] 40 | ); 41 | 42 | $response = $this->actingAs($user)->get($verificationUrl); 43 | 44 | Event::assertDispatched(Verified::class); 45 | $this->assertTrue($user->fresh()->hasVerifiedEmail()); 46 | $response->assertRedirect(RouteServiceProvider::HOME.'?verified=1'); 47 | } 48 | 49 | public function test_email_is_not_verified_with_invalid_hash() 50 | { 51 | $user = User::factory()->create([ 52 | 'email_verified_at' => null, 53 | ]); 54 | 55 | $verificationUrl = URL::temporarySignedRoute( 56 | 'verification.verify', 57 | now()->addMinutes(60), 58 | ['id' => $user->id, 'hash' => sha1('wrong-email')] 59 | ); 60 | 61 | $this->actingAs($user)->get($verificationUrl); 62 | 63 | $this->assertFalse($user->fresh()->hasVerifiedEmail()); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /resources/js/Components/ProductFilters/ProductPriceFilter.vue: -------------------------------------------------------------------------------- 1 | 29 | 30 | 62 | -------------------------------------------------------------------------------- /tests/Feature/Cart/ViewCartProductsTest.php: -------------------------------------------------------------------------------- 1 | create(); 21 | } 22 | 23 | public function test_guest_cannot_view_his_cart_products() 24 | { 25 | $response = $this->get('/cart'); 26 | 27 | $response->assertRedirect('login'); 28 | } 29 | 30 | public function test_auth_user_can_view_his_cart_products() 31 | { 32 | $product = Product::factory()->create(); 33 | $this->actingAs(User::factory()->create()); 34 | 35 | auth()->user()->cart() 36 | ->attach($product->id, ['quantity' => 1]); 37 | 38 | $response = $this->get('/cart'); 39 | 40 | $response 41 | ->assertInertia(function (AssertableInertia $page) { 42 | $page 43 | ->component('Cart') 44 | ->has('products', 1) 45 | ->has('savedProducts', 0); 46 | }); 47 | } 48 | 49 | public function test_auth_user_can_view_his_cart_products_that_are_in_the_saved_for_later_list() 50 | { 51 | $product = Product::factory()->create(); 52 | $this->actingAs(User::factory()->create()); 53 | 54 | auth()->user()->cart()->attach($product->id, ['quantity' => 1]); 55 | 56 | $cartProduct = auth()->user()->cart()->first(); 57 | 58 | $this->post("cart/$cartProduct->id/save-for-later"); 59 | 60 | $response = $this->get('/cart'); 61 | 62 | $response 63 | ->assertInertia(function (AssertableInertia $page) { 64 | $page 65 | ->component('Cart') 66 | ->has('products', 0) 67 | ->has('savedProducts', 1); 68 | }); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /tests/Feature/Auth/PasswordResetTest.php: -------------------------------------------------------------------------------- 1 | get('/forgot-password'); 18 | 19 | $response->assertStatus(200); 20 | } 21 | 22 | public function test_reset_password_link_can_be_requested() 23 | { 24 | Notification::fake(); 25 | 26 | $user = User::factory()->create(); 27 | 28 | $this->post('/forgot-password', ['email' => $user->email]); 29 | 30 | Notification::assertSentTo($user, ResetPassword::class); 31 | } 32 | 33 | public function test_reset_password_screen_can_be_rendered() 34 | { 35 | Notification::fake(); 36 | 37 | $user = User::factory()->create(); 38 | 39 | $this->post('/forgot-password', ['email' => $user->email]); 40 | 41 | Notification::assertSentTo($user, ResetPassword::class, function ($notification) { 42 | $response = $this->get('/reset-password/'.$notification->token); 43 | 44 | $response->assertStatus(200); 45 | 46 | return true; 47 | }); 48 | } 49 | 50 | public function test_password_can_be_reset_with_valid_token() 51 | { 52 | Notification::fake(); 53 | 54 | $user = User::factory()->create(); 55 | 56 | $this->post('/forgot-password', ['email' => $user->email]); 57 | 58 | Notification::assertSentTo($user, ResetPassword::class, function ($notification) use ($user) { 59 | $response = $this->post('/reset-password', [ 60 | 'token' => $notification->token, 61 | 'email' => $user->email, 62 | 'password' => 'password', 63 | 'password_confirmation' => 'password', 64 | ]); 65 | 66 | $response->assertSessionHasNoErrors(); 67 | 68 | return true; 69 | }); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "laravel/laravel", 3 | "type": "project", 4 | "description": "The Laravel Framework.", 5 | "keywords": ["framework", "laravel"], 6 | "license": "MIT", 7 | "require": { 8 | "php": "^8.0.2", 9 | "guzzlehttp/guzzle": "^7.2", 10 | "inertiajs/inertia-laravel": "^0.6.3", 11 | "itsgoingd/clockwork": "^5.1", 12 | "laravel/framework": "^9.19", 13 | "laravel/sanctum": "^2.8", 14 | "laravel/tinker": "^2.7", 15 | "stripe/stripe-php": "^9.9", 16 | "tightenco/ziggy": "^1.0" 17 | }, 18 | "require-dev": { 19 | "fakerphp/faker": "^1.9.1", 20 | "laravel/breeze": "^1.14", 21 | "laravel/pint": "^1.0", 22 | "laravel/sail": "^1.0.1", 23 | "mockery/mockery": "^1.4.4", 24 | "nunomaduro/collision": "^6.1", 25 | "phpunit/phpunit": "^9.5.10", 26 | "spatie/laravel-ignition": "^1.0" 27 | }, 28 | "autoload": { 29 | "psr-4": { 30 | "App\\": "app/", 31 | "Database\\Factories\\": "database/factories/", 32 | "Database\\Seeders\\": "database/seeders/" 33 | } 34 | }, 35 | "autoload-dev": { 36 | "psr-4": { 37 | "Tests\\": "tests/" 38 | } 39 | }, 40 | "scripts": { 41 | "post-autoload-dump": [ 42 | "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", 43 | "@php artisan package:discover --ansi" 44 | ], 45 | "post-update-cmd": [ 46 | "@php artisan vendor:publish --tag=laravel-assets --ansi --force" 47 | ], 48 | "post-root-package-install": [ 49 | "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" 50 | ], 51 | "post-create-project-cmd": [ 52 | "@php artisan key:generate --ansi" 53 | ] 54 | }, 55 | "extra": { 56 | "laravel": { 57 | "dont-discover": [] 58 | } 59 | }, 60 | "config": { 61 | "optimize-autoloader": true, 62 | "preferred-install": "dist", 63 | "sort-packages": true, 64 | "allow-plugins": { 65 | "pestphp/pest-plugin": true 66 | } 67 | }, 68 | "minimum-stability": "dev", 69 | "prefer-stable": true 70 | } 71 | -------------------------------------------------------------------------------- /resources/js/Components/Breeze/Dropdown.vue: -------------------------------------------------------------------------------- 1 | 43 | 44 | 72 | -------------------------------------------------------------------------------- /config/broadcasting.php: -------------------------------------------------------------------------------- 1 | env('BROADCAST_DRIVER', 'null'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Broadcast Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the broadcast connections that will be used 26 | | to broadcast events to other systems or over websockets. Samples of 27 | | each available type of connection are provided inside this array. 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'pusher' => [ 34 | 'driver' => 'pusher', 35 | 'key' => env('PUSHER_APP_KEY'), 36 | 'secret' => env('PUSHER_APP_SECRET'), 37 | 'app_id' => env('PUSHER_APP_ID'), 38 | 'options' => [ 39 | 'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com', 40 | 'port' => env('PUSHER_PORT', 443), 41 | 'scheme' => env('PUSHER_SCHEME', 'https'), 42 | 'encrypted' => true, 43 | 'useTLS' => env('PUSHER_SCHEME', 'https') === 'https', 44 | ], 45 | 'client_options' => [ 46 | // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html 47 | ], 48 | ], 49 | 50 | 'ably' => [ 51 | 'driver' => 'ably', 52 | 'key' => env('ABLY_KEY'), 53 | ], 54 | 55 | 'redis' => [ 56 | 'driver' => 'redis', 57 | 'connection' => 'default', 58 | ], 59 | 60 | 'log' => [ 61 | 'driver' => 'log', 62 | ], 63 | 64 | 'null' => [ 65 | 'driver' => 'null', 66 | ], 67 | 68 | ], 69 | 70 | ]; 71 | -------------------------------------------------------------------------------- /tests/Feature/Cart/SaveForLaterTest.php: -------------------------------------------------------------------------------- 1 | create(); 20 | } 21 | 22 | public function test_cart_product_can_be_moved_from_cart_to_save_for_later_list() 23 | { 24 | $product = Product::factory()->create(); 25 | $this->actingAs(User::factory()->create()); 26 | 27 | auth()->user()->cart() 28 | ->attach($product->id, ['quantity' => 1]); 29 | 30 | $cartProduct = auth()->user()->cart()->first(); 31 | 32 | $this->assertFalse($cartProduct->pivot->saved_for_later); 33 | 34 | $this->post("cart/$cartProduct->id/save-for-later"); 35 | 36 | $this->assertTrue($cartProduct->pivot->fresh()->saved_for_later); 37 | } 38 | 39 | public function test_cart_product_can_be_moved_from_save_for_later_list_to_cart() 40 | { 41 | $product = Product::factory()->create(); 42 | $this->actingAs(User::factory()->create()); 43 | 44 | auth()->user()->cart() 45 | ->attach($product->id, ['quantity' => 1]); 46 | 47 | $cartProduct = auth()->user()->cart()->first(); 48 | 49 | $this->assertFalse($cartProduct->pivot->saved_for_later); 50 | 51 | $this->post("cart/$cartProduct->id/save-for-later"); 52 | 53 | $this->assertTrue($cartProduct->pivot->fresh()->saved_for_later); 54 | 55 | $this->post("cart/$cartProduct->id/move-to-cart"); 56 | 57 | $this->assertFalse($cartProduct->pivot->saved_for_later); 58 | } 59 | 60 | public function test_when_product_is_moved_to_the_save_for_later_list_its_quantity_is_reset_to_1() 61 | { 62 | $product = Product::factory()->create(); 63 | $this->actingAs(User::factory()->create()); 64 | 65 | auth()->user()->cart() 66 | ->attach($product->id, ['quantity' => 2]); 67 | 68 | $cartProduct = auth()->user()->cart()->first(); 69 | 70 | $this->post("cart/$cartProduct->id/save-for-later"); 71 | 72 | $this->assertEquals(1, $cartProduct->pivot->fresh()->quantity); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /resources/js/Components/ProductCard.vue: -------------------------------------------------------------------------------- 1 | 25 | 26 | 55 | -------------------------------------------------------------------------------- /routes/auth.php: -------------------------------------------------------------------------------- 1 | group(function () { 14 | Route::get('register', [RegisteredUserController::class, 'create']) 15 | ->name('register'); 16 | 17 | Route::post('register', [RegisteredUserController::class, 'store']); 18 | 19 | Route::get('login', [AuthenticatedSessionController::class, 'create']) 20 | ->name('login'); 21 | 22 | Route::post('login', [AuthenticatedSessionController::class, 'store']); 23 | 24 | Route::get('forgot-password', [PasswordResetLinkController::class, 'create']) 25 | ->name('password.request'); 26 | 27 | Route::post('forgot-password', [PasswordResetLinkController::class, 'store']) 28 | ->name('password.email'); 29 | 30 | Route::get('reset-password/{token}', [NewPasswordController::class, 'create']) 31 | ->name('password.reset'); 32 | 33 | Route::post('reset-password', [NewPasswordController::class, 'store']) 34 | ->name('password.update'); 35 | }); 36 | 37 | Route::middleware('auth')->group(function () { 38 | Route::get('verify-email', [EmailVerificationPromptController::class, '__invoke']) 39 | ->name('verification.notice'); 40 | 41 | Route::get('verify-email/{id}/{hash}', [VerifyEmailController::class, '__invoke']) 42 | ->middleware(['signed', 'throttle:6,1']) 43 | ->name('verification.verify'); 44 | 45 | Route::post('email/verification-notification', [EmailVerificationNotificationController::class, 'store']) 46 | ->middleware('throttle:6,1') 47 | ->name('verification.send'); 48 | 49 | Route::get('confirm-password', [ConfirmablePasswordController::class, 'show']) 50 | ->name('password.confirm'); 51 | 52 | Route::post('confirm-password', [ConfirmablePasswordController::class, 'store']); 53 | 54 | Route::post('logout', [AuthenticatedSessionController::class, 'destroy']) 55 | ->name('logout'); 56 | }); 57 | -------------------------------------------------------------------------------- /config/sanctum.php: -------------------------------------------------------------------------------- 1 | explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf( 19 | '%s%s', 20 | 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1', 21 | Sanctum::currentApplicationUrlWithPort() 22 | ))), 23 | 24 | /* 25 | |-------------------------------------------------------------------------- 26 | | Sanctum Guards 27 | |-------------------------------------------------------------------------- 28 | | 29 | | This array contains the authentication guards that will be checked when 30 | | Sanctum is trying to authenticate a request. If none of these guards 31 | | are able to authenticate the request, Sanctum will use the bearer 32 | | token that's present on an incoming request for authentication. 33 | | 34 | */ 35 | 36 | 'guard' => ['web'], 37 | 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | Expiration Minutes 41 | |-------------------------------------------------------------------------- 42 | | 43 | | This value controls the number of minutes until an issued token will be 44 | | considered expired. If this value is null, personal access tokens do 45 | | not expire. This won't tweak the lifetime of first-party sessions. 46 | | 47 | */ 48 | 49 | 'expiration' => null, 50 | 51 | /* 52 | |-------------------------------------------------------------------------- 53 | | Sanctum Middleware 54 | |-------------------------------------------------------------------------- 55 | | 56 | | When authenticating your first-party SPA with Sanctum you may need to 57 | | customize some of the middleware Sanctum uses while processing the 58 | | request. You may change the middleware listed below as required. 59 | | 60 | */ 61 | 62 | 'middleware' => [ 63 | 'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class, 64 | 'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class, 65 | ], 66 | 67 | ]; 68 | -------------------------------------------------------------------------------- /tests/Feature/Dashboard/DashboardSettingsPassworTest.php: -------------------------------------------------------------------------------- 1 | create(['name' => 'test']); 18 | $this->actingAs($user); 19 | 20 | $response = $this->get('/dashboard/settings/password'); 21 | 22 | $response 23 | ->assertInertia(function (AssertableInertia $page) { 24 | $page 25 | ->component('Dashboard/Settings/Password'); 26 | }); 27 | } 28 | 29 | public function test_user_can_update_his_password(): void 30 | { 31 | $user = User::factory()->create(['name' => 'test']); 32 | $this->actingAs($user); 33 | 34 | $this->assertTrue(Hash::check('password', $user->password)); 35 | 36 | $this->patch('/dashboard/settings/password', [ 37 | 'current_password' => 'password', 38 | 'password' => 'newpassword', 39 | 'password_confirmation' => 'newpassword' 40 | ]); 41 | 42 | $this->assertTrue(Hash::check('newpassword', $user->fresh()->password)); 43 | } 44 | 45 | public function test_error_if_current_password_dont_match(): void 46 | { 47 | $user = User::factory()->create(['name' => 'test']); 48 | $this->actingAs($user); 49 | 50 | $this->assertTrue(Hash::check('password', $user->password)); 51 | 52 | $this->patch('/dashboard/settings/password', [ 53 | 'current_password' => 'wrongpassword', 54 | 'password' => 'test', 55 | 'password_confirmation' => 'test' 56 | ]) 57 | ->assertSessionHasErrorsIn('current_password'); 58 | } 59 | 60 | public function test_error_if_new_passwords_must_be_the_same(): void 61 | { 62 | $user = User::factory()->create(['name' => 'test']); 63 | $this->actingAs($user); 64 | 65 | $this->assertTrue(Hash::check('password', $user->password)); 66 | 67 | $this->patch('/dashboard/settings/password', [ 68 | 'current_password' => 'password', 69 | 'password' => 'newpassword', 70 | 'password_confirmation' => 'wrongpassword' 71 | ]) 72 | ->assertSessionHasErrorsIn('password'); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /app/Http/Requests/Auth/LoginRequest.php: -------------------------------------------------------------------------------- 1 | ['required', 'string', 'email'], 33 | 'password' => ['required', 'string'], 34 | ]; 35 | } 36 | 37 | /** 38 | * Attempt to authenticate the request's credentials. 39 | * 40 | * @return void 41 | * 42 | * @throws \Illuminate\Validation\ValidationException 43 | */ 44 | public function authenticate() 45 | { 46 | $this->ensureIsNotRateLimited(); 47 | 48 | if (! Auth::attempt($this->only('email', 'password'), $this->boolean('remember'))) { 49 | RateLimiter::hit($this->throttleKey()); 50 | 51 | throw ValidationException::withMessages([ 52 | 'email' => trans('auth.failed'), 53 | ]); 54 | } 55 | 56 | RateLimiter::clear($this->throttleKey()); 57 | } 58 | 59 | /** 60 | * Ensure the login request is not rate limited. 61 | * 62 | * @return void 63 | * 64 | * @throws \Illuminate\Validation\ValidationException 65 | */ 66 | public function ensureIsNotRateLimited() 67 | { 68 | if (! RateLimiter::tooManyAttempts($this->throttleKey(), 5)) { 69 | return; 70 | } 71 | 72 | event(new Lockout($this)); 73 | 74 | $seconds = RateLimiter::availableIn($this->throttleKey()); 75 | 76 | throw ValidationException::withMessages([ 77 | 'email' => trans('auth.throttle', [ 78 | 'seconds' => $seconds, 79 | 'minutes' => ceil($seconds / 60), 80 | ]), 81 | ]); 82 | } 83 | 84 | /** 85 | * Get the rate limiting throttle key for the request. 86 | * 87 | * @return string 88 | */ 89 | public function throttleKey() 90 | { 91 | return Str::transliterate(Str::lower($this->input('email')).'|'.$this->ip()); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /config/filesystems.php: -------------------------------------------------------------------------------- 1 | env('FILESYSTEM_DISK', 'local'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Filesystem Disks 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure as many filesystem "disks" as you wish, and you 24 | | may even configure multiple disks of the same driver. Defaults have 25 | | been set up for each driver as an example of the required values. 26 | | 27 | | Supported Drivers: "local", "ftp", "sftp", "s3" 28 | | 29 | */ 30 | 31 | 'disks' => [ 32 | 33 | 'local' => [ 34 | 'driver' => 'local', 35 | 'root' => storage_path('app'), 36 | 'throw' => false, 37 | ], 38 | 39 | 'public' => [ 40 | 'driver' => 'local', 41 | 'root' => storage_path('app/public'), 42 | 'url' => env('APP_URL').'/storage', 43 | 'visibility' => 'public', 44 | 'throw' => false, 45 | ], 46 | 47 | 's3' => [ 48 | 'driver' => 's3', 49 | 'key' => env('AWS_ACCESS_KEY_ID'), 50 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 51 | 'region' => env('AWS_DEFAULT_REGION'), 52 | 'bucket' => env('AWS_BUCKET'), 53 | 'url' => env('AWS_URL'), 54 | 'endpoint' => env('AWS_ENDPOINT'), 55 | 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), 56 | 'throw' => false, 57 | ], 58 | 59 | ], 60 | 61 | /* 62 | |-------------------------------------------------------------------------- 63 | | Symbolic Links 64 | |-------------------------------------------------------------------------- 65 | | 66 | | Here you may configure the symbolic links that will be created when the 67 | | `storage:link` Artisan command is executed. The array keys should be 68 | | the locations of the links and the values should be their targets. 69 | | 70 | */ 71 | 72 | 'links' => [ 73 | public_path('storage') => storage_path('app/public'), 74 | ], 75 | 76 | ]; 77 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/NewPasswordController.php: -------------------------------------------------------------------------------- 1 | $request->email, 27 | 'token' => $request->route('token'), 28 | ]); 29 | } 30 | 31 | /** 32 | * Handle an incoming new password request. 33 | * 34 | * @param \Illuminate\Http\Request $request 35 | * @return \Illuminate\Http\RedirectResponse 36 | * 37 | * @throws \Illuminate\Validation\ValidationException 38 | */ 39 | public function store(Request $request) 40 | { 41 | $request->validate([ 42 | 'token' => 'required', 43 | 'email' => 'required|email', 44 | 'password' => ['required', 'confirmed', Rules\Password::defaults()], 45 | ]); 46 | 47 | // Here we will attempt to reset the user's password. If it is successful we 48 | // will update the password on an actual user model and persist it to the 49 | // database. Otherwise we will parse the error and return the response. 50 | $status = Password::reset( 51 | $request->only('email', 'password', 'password_confirmation', 'token'), 52 | function ($user) use ($request) { 53 | $user->forceFill([ 54 | 'password' => Hash::make($request->password), 55 | 'remember_token' => Str::random(60), 56 | ])->save(); 57 | 58 | event(new PasswordReset($user)); 59 | } 60 | ); 61 | 62 | // If the password was successfully reset, we will redirect the user back to 63 | // the application's home authenticated view. If there is an error we can 64 | // redirect them back to where they came from with their error message. 65 | if ($status == Password::PASSWORD_RESET) { 66 | return redirect()->route('login')->with('status', __($status)); 67 | } 68 | 69 | throw ValidationException::withMessages([ 70 | 'email' => [trans($status)], 71 | ]); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /tests/Feature/Cart/UpdateProductsInCartTest.php: -------------------------------------------------------------------------------- 1 | create(); 20 | } 21 | 22 | public function test_guest_cannot_add_update_his_cart() 23 | { 24 | $this->patch('/cart/1/increase')->assertRedirect('login'); 25 | $this->patch('/cart/1/decrease')->assertRedirect('login'); 26 | } 27 | 28 | public function test_auth_user_can_increase_product_quantity() 29 | { 30 | $product = Product::factory()->create(['available_quantity' => 2]); 31 | $this->actingAs(User::factory()->create()); 32 | 33 | $this->post("/cart/$product->id"); 34 | 35 | $this->assertDatabaseHas('carts', [ 36 | 'user_id' => 1, 37 | 'product_id' => 1, 38 | 'quantity' => 1 39 | ]); 40 | 41 | $this->patch("/cart/$product->id/increase"); 42 | 43 | $this->assertDatabaseHas('carts', [ 44 | 'user_id' => 1, 45 | 'product_id' => 1, 46 | 'quantity' => 2 47 | ]); 48 | } 49 | 50 | public function test_auth_user_can_decrease_product_quantity() 51 | { 52 | $product = Product::factory()->create(['available_quantity' => 2]); 53 | $this->actingAs(User::factory()->create()); 54 | 55 | $this->post("/cart/$product->id"); 56 | $this->post("/cart/$product->id"); 57 | 58 | $this->assertDatabaseHas('carts', [ 59 | 'user_id' => 1, 60 | 'product_id' => 1, 61 | 'quantity' => 2 62 | ]); 63 | 64 | $this->patch("/cart/$product->id/decrease"); 65 | 66 | $this->assertDatabaseHas('carts', [ 67 | 'user_id' => 1, 68 | 'product_id' => 1, 69 | 'quantity' => 1 70 | ]); 71 | } 72 | 73 | public function test_if_the_quantity_of_an_product_in_the_cart_drops_to_0_the_product_is_removed() 74 | { 75 | $product = Product::factory()->create(['available_quantity' => 1]); 76 | $this->actingAs(User::factory()->create()); 77 | 78 | $this->post("/cart/$product->id"); 79 | 80 | $this->assertDatabaseHas('carts', [ 81 | 'user_id' => 1, 82 | 'product_id' => 1, 83 | 'quantity' => 1 84 | ]); 85 | 86 | $this->patch("/cart/$product->id/decrease"); 87 | 88 | $this->assertDatabaseMissing('carts', [ 89 | 'user_id' => 1, 90 | 'product_id' => 1, 91 | ]); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /tests/Feature/Cart/AddProductsToCartTest.php: -------------------------------------------------------------------------------- 1 | create(); 20 | } 21 | 22 | public function test_guest_cannot_add_products_to_his_cart() 23 | { 24 | $response = $this->post('/cart/1'); 25 | 26 | $response->assertRedirect('login'); 27 | } 28 | 29 | public function test_auth_user_can_add_products_to_his_cart() 30 | { 31 | $this->actingAs(User::factory()->create()); 32 | 33 | Product::factory(2)->create(); 34 | 35 | $this->post('/cart/1'); 36 | 37 | $this->assertDatabaseHas('carts', [ 38 | 'user_id' => 1, 39 | 'product_id' => 1, 40 | 'quantity' => 1 41 | ]); 42 | } 43 | 44 | public function test_if_product_is_already_in_the_cart_update_its_quantity() 45 | { 46 | $this->actingAs(User::factory()->create()); 47 | 48 | $product = Product::factory()->create(['available_quantity' => 2]); 49 | 50 | $this->post("/cart/$product->id"); 51 | 52 | $this->assertDatabaseHas('carts', [ 53 | 'user_id' => 1, 54 | 'product_id' => $product->id, 55 | 'quantity' => 1 56 | ]); 57 | 58 | $this->post("/cart/$product->id"); 59 | 60 | $this->assertDatabaseHas('carts', [ 61 | 'user_id' => 1, 62 | 'product_id' => $product->id, 63 | 'quantity' => 2 64 | ]); 65 | } 66 | 67 | public function test_if_the_quantity_the_user_wants_is_not_available_return_error_message() 68 | { 69 | $this->actingAs(User::factory()->create()); 70 | 71 | $product = Product::factory()->create(['available_quantity' => 2]); 72 | 73 | $this->post("/cart/$product->id"); 74 | 75 | $this->assertDatabaseHas('carts', [ 76 | 'user_id' => 1, 77 | 'product_id' => $product->id, 78 | 'quantity' => 1 79 | ]); 80 | 81 | $this->post("/cart/$product->id"); 82 | 83 | $this->assertDatabaseHas('carts', [ 84 | 'user_id' => 1, 85 | 'product_id' => $product->id, 86 | 'quantity' => 2 87 | ]); 88 | 89 | $this->post("/cart/$product->id") 90 | ->assertSessionHas('error', 'The selected quantity is not available at the moment.'); 91 | 92 | 93 | $this->assertDatabaseHas('carts', [ 94 | 'user_id' => 1, 95 | 'product_id' => $product->id, 96 | 'quantity' => 2 97 | ]); 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /app/Http/Kernel.php: -------------------------------------------------------------------------------- 1 | 15 | */ 16 | protected $middleware = [ 17 | // \App\Http\Middleware\TrustHosts::class, 18 | \App\Http\Middleware\TrustProxies::class, 19 | \Illuminate\Http\Middleware\HandleCors::class, 20 | \App\Http\Middleware\PreventRequestsDuringMaintenance::class, 21 | \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, 22 | \App\Http\Middleware\TrimStrings::class, 23 | \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, 24 | ]; 25 | 26 | /** 27 | * The application's route middleware groups. 28 | * 29 | * @var array> 30 | */ 31 | protected $middlewareGroups = [ 32 | 'web' => [ 33 | \App\Http\Middleware\EncryptCookies::class, 34 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, 35 | \Illuminate\Session\Middleware\StartSession::class, 36 | \Illuminate\View\Middleware\ShareErrorsFromSession::class, 37 | \App\Http\Middleware\VerifyCsrfToken::class, 38 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 39 | \App\Http\Middleware\HandleInertiaRequests::class, 40 | \Illuminate\Http\Middleware\AddLinkHeadersForPreloadedAssets::class, 41 | ], 42 | 43 | 'api' => [ 44 | // \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class, 45 | 'throttle:api', 46 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 47 | ], 48 | ]; 49 | 50 | /** 51 | * The application's route middleware. 52 | * 53 | * These middleware may be assigned to groups or used individually. 54 | * 55 | * @var array 56 | */ 57 | protected $routeMiddleware = [ 58 | 'auth' => \App\Http\Middleware\Authenticate::class, 59 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 60 | 'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class, 61 | 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 62 | 'can' => \Illuminate\Auth\Middleware\Authorize::class, 63 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 64 | 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, 65 | 'signed' => \App\Http\Middleware\ValidateSignature::class, 66 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 67 | 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 68 | ]; 69 | } 70 | -------------------------------------------------------------------------------- /resources/js/Components/Breeze/ApplicationLogo.vue: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /app/Models/Order.php: -------------------------------------------------------------------------------- 1 | when($sortBy, function ($query) use ($sortBy) { 17 | switch ($sortBy) { 18 | case 'total_desc': 19 | $query->orderBy('total', 'desc'); 20 | break; 21 | case 'total_asc': 22 | $query->orderBy('total', 'asc'); 23 | break; 24 | default: 25 | $query->orderBy('created_at', 'desc'); 26 | break; 27 | } 28 | }); 29 | } 30 | 31 | public function scopeWithDashboardData($query) 32 | { 33 | $query 34 | ->selectRaw(' 35 | sum(total) as total_spent, 36 | COUNT(*) as orders_placed, 37 | ROUND(avg(total), 2) as avg_expense, 38 | MAX(total) as max_expense 39 | ') 40 | ->groupBy('orders.user_id'); 41 | } 42 | 43 | public function scopeWithTimespan($query, $timespan) 44 | { 45 | switch ($timespan) { 46 | case 'current_week': 47 | $period = CarbonPeriod::between( 48 | now()->startOfWeek(), 49 | now() 50 | ); 51 | 52 | $query->whereBetween('created_at', [$period->getStartDate(), $period->getEndDate()]); 53 | break; 54 | 55 | case 'last_week': 56 | $period = CarbonPeriod::between( 57 | now()->subDays(7)->startOfWeek(), 58 | now()->subDays(7)->endOfWeek() 59 | ); 60 | 61 | $query->whereBetween('created_at', [$period->getStartDate(), $period->getEndDate()]); 62 | break; 63 | 64 | case 'last_month': 65 | $period = CarbonPeriod::between( 66 | now()->subDays(30)->startOfMonth(), 67 | now()->subDays(30)->endOfMonth() 68 | ); 69 | 70 | $query->whereBetween('created_at', [$period->getStartDate(), $period->getEndDate()]); 71 | break; 72 | } 73 | } 74 | 75 | public function user() 76 | { 77 | return $this->belongsTo(User::class); 78 | } 79 | 80 | public function products() 81 | { 82 | return $this->belongsToMany(Product::class, 'order_product') 83 | ->withPivot(['quantity', 'unit_price']) 84 | ->withTimestamps(); 85 | } 86 | 87 | public function detail() 88 | { 89 | return $this->hasOne(OrderDetail::class); 90 | } 91 | 92 | public function payment() 93 | { 94 | return $this->hasOne(Payment::class, 'order_id', 'id'); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /app/Http/Controllers/CartController.php: -------------------------------------------------------------------------------- 1 | $products, 18 | 'savedProducts' => $savedProducts, 19 | 'total' => $total, 20 | ]); 21 | } 22 | 23 | public function store(Product $product) 24 | { 25 | $productInCart = auth()->user()->cart() 26 | ->firstWhere('product_id', $product->id); 27 | 28 | if ($productInCart) { 29 | return $this->increaseQty($productInCart); 30 | } 31 | 32 | auth()->user()->cart() 33 | ->attach($product->id, ['quantity' => 1]); 34 | 35 | return back(); 36 | } 37 | 38 | public function increase(Product $product) 39 | { 40 | $productInCart = auth()->user()->cart() 41 | ->firstWhere('product_id', $product->id); 42 | 43 | $this->increaseQty($productInCart); 44 | 45 | return back()->with('success', true); 46 | } 47 | 48 | public function decrease(Product $product) 49 | { 50 | $productInCart = auth()->user()->cart() 51 | ->firstWhere('product_id', $product->id); 52 | 53 | $this->decreaseQty($productInCart); 54 | 55 | return back()->with('success', true); 56 | } 57 | 58 | public function destroy(Product $product) 59 | { 60 | auth()->user()->cart() 61 | ->detach(['product_id' => $product->id]); 62 | 63 | return back(); 64 | } 65 | 66 | public function empty() 67 | { 68 | Cart::empty(); 69 | 70 | return back(); 71 | } 72 | 73 | /** 74 | * @param Product $productInCart 75 | * @return void 76 | */ 77 | protected function increaseQty($productInCart) 78 | { 79 | if ($productInCart->available_quantity > $productInCart->pivot->quantity) { 80 | $productInCart->pivot->quantity = $productInCart->pivot->quantity + 1; 81 | $productInCart->pivot->save(); 82 | } else { 83 | return back()->with('error', 'The selected quantity is not available at the moment.'); 84 | } 85 | } 86 | 87 | /** 88 | * @param Product $productInCart 89 | * @return void 90 | */ 91 | protected function decreaseQty($productInCart) 92 | { 93 | if ($productInCart->pivot->quantity === 1) { 94 | auth()->user()->cart() 95 | ->detach(['product_id' => $productInCart->pivot->product_id]); 96 | 97 | return; 98 | } 99 | 100 | $productInCart->pivot->quantity = $productInCart->pivot->quantity - 1; 101 | $productInCart->pivot->save(); 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /app/Models/Product.php: -------------------------------------------------------------------------------- 1 | 'decimal:2' 16 | ]; 17 | 18 | protected $with = ['images']; 19 | 20 | public function scopeWithCategories($query, $categorySlugs) 21 | { 22 | $query->when($categorySlugs, function ($query) use ($categorySlugs) { 23 | $query->whereHas('category', function ($query) use ($categorySlugs) { 24 | if (Str::contains($categorySlugs, ',')) { 25 | $query->whereIn('slug', explode(',', $categorySlugs)); 26 | } else { 27 | $query->where('slug', $categorySlugs); 28 | } 29 | }); 30 | }); 31 | } 32 | 33 | public function scopeWithMinPrice($query, $min_price) 34 | { 35 | $query->when($min_price, function ($query) use ($min_price) { 36 | $query->where('price', '>=', $min_price); 37 | }); 38 | } 39 | 40 | public function scopeWithMaxPrice($query, $max_price) 41 | { 42 | $query->when($max_price, function ($query) use ($max_price) { 43 | $query->where('price', '<=', $max_price); 44 | }); 45 | } 46 | 47 | public function scopeWithSearch($query, $search) 48 | { 49 | $query->when($search, function ($query) use ($search) { 50 | $query->where('name', 'LIKE', "%$search%"); 51 | }); 52 | } 53 | 54 | public function scopeWithSortBy($query, $sortBy) 55 | { 56 | $query->when($sortBy, function ($query) use ($sortBy) { 57 | switch ($sortBy) { 58 | case 'price_desc': 59 | $query->orderBy('price', 'desc'); 60 | break; 61 | case 'price_asc': 62 | $query->orderBy('price', 'asc'); 63 | break; 64 | case 'best_selling': 65 | $query 66 | ->selectRaw('products.*, SUM(quantity) as best_selling') 67 | ->leftJoin('order_product', 'products.id', '=', 'order_product.product_id') 68 | ->groupBy('products.id') 69 | ->orderBy('best_selling', 'desc'); 70 | break; 71 | default: 72 | $query->orderBy('created_at', 'desc'); 73 | break; 74 | } 75 | }); 76 | } 77 | 78 | public function category() 79 | { 80 | return $this->belongsTo(Category::class); 81 | } 82 | 83 | public function orders() 84 | { 85 | return $this->belongsToMany(Order::class, 'order_product') 86 | ->withPivot(['quantity', 'unit_price']) 87 | ->withTimestamps(); 88 | } 89 | 90 | public function images() 91 | { 92 | return $this->morphMany(Image::class, 'imageable'); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /resources/js/Components/Dashboard/DashboardAsideMenu.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | -------------------------------------------------------------------------------- /resources/js/Pages/Auth/ResetPassword.vue: -------------------------------------------------------------------------------- 1 | 27 | 28 | 90 | -------------------------------------------------------------------------------- /resources/js/Pages/Checkout/Success.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | -------------------------------------------------------------------------------- /config/queue.php: -------------------------------------------------------------------------------- 1 | env('QUEUE_CONNECTION', 'sync'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Queue Connections 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure the connection information for each server that 24 | | is used by your application. A default configuration has been added 25 | | for each back-end shipped with Laravel. You are free to add more. 26 | | 27 | | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'sync' => [ 34 | 'driver' => 'sync', 35 | ], 36 | 37 | 'database' => [ 38 | 'driver' => 'database', 39 | 'table' => 'jobs', 40 | 'queue' => 'default', 41 | 'retry_after' => 90, 42 | 'after_commit' => false, 43 | ], 44 | 45 | 'beanstalkd' => [ 46 | 'driver' => 'beanstalkd', 47 | 'host' => 'localhost', 48 | 'queue' => 'default', 49 | 'retry_after' => 90, 50 | 'block_for' => 0, 51 | 'after_commit' => false, 52 | ], 53 | 54 | 'sqs' => [ 55 | 'driver' => 'sqs', 56 | 'key' => env('AWS_ACCESS_KEY_ID'), 57 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 58 | 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), 59 | 'queue' => env('SQS_QUEUE', 'default'), 60 | 'suffix' => env('SQS_SUFFIX'), 61 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 62 | 'after_commit' => false, 63 | ], 64 | 65 | 'redis' => [ 66 | 'driver' => 'redis', 67 | 'connection' => 'default', 68 | 'queue' => env('REDIS_QUEUE', 'default'), 69 | 'retry_after' => 90, 70 | 'block_for' => null, 71 | 'after_commit' => false, 72 | ], 73 | 74 | ], 75 | 76 | /* 77 | |-------------------------------------------------------------------------- 78 | | Failed Queue Jobs 79 | |-------------------------------------------------------------------------- 80 | | 81 | | These options configure the behavior of failed queue job logging so you 82 | | can control which database and table are used to store the jobs that 83 | | have failed. You may change them to any database / table you wish. 84 | | 85 | */ 86 | 87 | 'failed' => [ 88 | 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), 89 | 'database' => env('DB_CONNECTION', 'mysql'), 90 | 'table' => 'failed_jobs', 91 | ], 92 | 93 | ]; 94 | -------------------------------------------------------------------------------- /resources/js/Components/ProductFilters/ProductCategoryFilter.vue: -------------------------------------------------------------------------------- 1 | 41 | 42 | 75 | -------------------------------------------------------------------------------- /resources/js/Pages/Dashboard/Settings/Profile.vue: -------------------------------------------------------------------------------- 1 | 21 | 22 | -------------------------------------------------------------------------------- /resources/js/Components/ProductFilters/AppliedFilters.vue: -------------------------------------------------------------------------------- 1 | 47 | 48 | --------------------------------------------------------------------------------