diff --git a/packages/Webkul/Shop/src/Http/routes.php b/packages/Webkul/Shop/src/Http/routes.php index 88b12401f..edb29e764 100755 --- a/packages/Webkul/Shop/src/Http/routes.php +++ b/packages/Webkul/Shop/src/Http/routes.php @@ -1,122 +1,142 @@ ['web', 'locale', 'theme', 'currency']], function () { - //Store front home + /** + * Store front home. + */ Route::get('/', 'Webkul\Shop\Http\Controllers\HomeController@index')->defaults('_config', [ 'view' => 'shop::home.index' ])->name('shop.home.index'); - //subscription - //subscribe - Route::get('/subscribe', 'Webkul\Shop\Http\Controllers\SubscriptionController@subscribe')->name('shop.subscribe'); - - //unsubscribe - Route::get('/unsubscribe/{token}', 'Webkul\Shop\Http\Controllers\SubscriptionController@unsubscribe')->name('shop.unsubscribe'); - - //Store front search + /** + * Store front search. + */ Route::get('/search', 'Webkul\Shop\Http\Controllers\SearchController@index')->defaults('_config', [ 'view' => 'shop::search.search' ])->name('shop.search.index'); - //Upload image for search product Route::post('/upload-search-image', 'Webkul\Shop\Http\Controllers\HomeController@upload')->name('shop.image.search.upload'); - //Country State Selector + /** + * Subscription. + */ + Route::get('/subscribe', 'Webkul\Shop\Http\Controllers\SubscriptionController@subscribe')->name('shop.subscribe'); + + Route::get('/unsubscribe/{token}', 'Webkul\Shop\Http\Controllers\SubscriptionController@unsubscribe')->name('shop.unsubscribe'); + + /** + * Country-State selector. + */ Route::get('get/countries', 'Webkul\Core\Http\Controllers\CountryStateController@getCountries')->defaults('_config', [ 'view' => 'shop::test' ])->name('get.countries'); - //Get States When Country is Passed + /** + * Get States when Country is passed. + */ Route::get('get/states/{country}', 'Webkul\Core\Http\Controllers\CountryStateController@getStates')->defaults('_config', [ 'view' => 'shop::test' ])->name('get.states'); - //checkout and cart - //Cart Items(listing) + /** + * Cart, coupons and checkout. + */ + // Cart items listing. Route::get('checkout/cart', 'Webkul\Shop\Http\Controllers\CartController@index')->defaults('_config', [ 'view' => 'shop::checkout.cart.index' ])->name('shop.checkout.cart.index'); - Route::post('checkout/cart/coupon', 'Webkul\Shop\Http\Controllers\CartController@applyCoupon')->name('shop.checkout.cart.coupon.apply'); - - Route::delete('checkout/cart/coupon', 'Webkul\Shop\Http\Controllers\CartController@removeCoupon')->name('shop.checkout.coupon.remove.coupon'); - - //Cart Items Add + // Add cart items. Route::post('checkout/cart/add/{id}', 'Webkul\Shop\Http\Controllers\CartController@add')->defaults('_config', [ 'redirect' => 'shop.checkout.cart.index' ])->name('cart.add'); - //Cart Items Remove + // Cart items remove. Route::get('checkout/cart/remove/{id}', 'Webkul\Shop\Http\Controllers\CartController@remove')->name('cart.remove'); - //Cart Update Before Checkout + // Cart update before checkout. Route::post('/checkout/cart', 'Webkul\Shop\Http\Controllers\CartController@updateBeforeCheckout')->defaults('_config', [ 'redirect' => 'shop.checkout.cart.index' ])->name('shop.checkout.cart.update'); - //Cart Items Remove + // Cart items remove. Route::get('/checkout/cart/remove/{id}', 'Webkul\Shop\Http\Controllers\CartController@remove')->defaults('_config', [ 'redirect' => 'shop.checkout.cart.index' ])->name('shop.checkout.cart.remove'); - //Checkout Index page + // Move item to wishlist from cart. + Route::post('move/wishlist/{id}', 'Webkul\Shop\Http\Controllers\CartController@moveToWishlist')->name('shop.movetowishlist'); + + // Apply coupons. + Route::post('checkout/cart/coupon', 'Webkul\Shop\Http\Controllers\CartController@applyCoupon')->name('shop.checkout.cart.coupon.apply'); + + // Remove coupons. + Route::delete('checkout/cart/coupon', 'Webkul\Shop\Http\Controllers\CartController@removeCoupon')->name('shop.checkout.coupon.remove.coupon'); + + // Checkout index page. Route::get('/checkout/onepage', 'Webkul\Shop\Http\Controllers\OnepageController@index')->defaults('_config', [ 'view' => 'shop::checkout.onepage' ])->name('shop.checkout.onepage.index'); - //Checkout Save Order + // Checkout get summary. Route::get('/checkout/summary', 'Webkul\Shop\Http\Controllers\OnepageController@summary')->name('shop.checkout.summary'); - //Checkout Save Address Form Store + // Checkout save address form. Route::post('/checkout/save-address', 'Webkul\Shop\Http\Controllers\OnepageController@saveAddress')->name('shop.checkout.save-address'); - //Checkout Save Shipping Address Form Store + // Checkout save shipping address form. Route::post('/checkout/save-shipping', 'Webkul\Shop\Http\Controllers\OnepageController@saveShipping')->name('shop.checkout.save-shipping'); - //Checkout Save Payment Method Form + // Checkout save payment method form. Route::post('/checkout/save-payment', 'Webkul\Shop\Http\Controllers\OnepageController@savePayment')->name('shop.checkout.save-payment'); - /* check minimum order */ + // Check minimum order. Route::post('/checkout/check-minimum-order', 'Webkul\Shop\Http\Controllers\OnepageController@checkMinimumOrder')->name('shop.checkout.check-minimum-order'); - //Checkout Save Order + // Checkout save order. Route::post('/checkout/save-order', 'Webkul\Shop\Http\Controllers\OnepageController@saveOrder')->name('shop.checkout.save-order'); - //Checkout Order Successfull + // Checkout order successful. Route::get('/checkout/success', 'Webkul\Shop\Http\Controllers\OnepageController@success')->defaults('_config', [ 'view' => 'shop::checkout.success' ])->name('shop.checkout.success'); - //Shop buynow button action - Route::post('move/wishlist/{id}', 'Webkul\Shop\Http\Controllers\CartController@moveToWishlist')->name('shop.movetowishlist'); - - Route::get('/downloadable/download-sample/{type}/{id}', 'Webkul\Shop\Http\Controllers\ProductController@downloadSample')->name('shop.downloadable.download_sample'); - - // Show Product Review Form + /** + * Product reviews. + */ + // Show product review form. Route::get('/reviews/{slug}', 'Webkul\Shop\Http\Controllers\ReviewController@show')->defaults('_config', [ 'view' => 'shop::products.reviews.index' ])->name('shop.reviews.index'); - // Show Product Review(listing) + // Show product review listing. Route::get('/product/{slug}/review', 'Webkul\Shop\Http\Controllers\ReviewController@create')->defaults('_config', [ 'view' => 'shop::products.reviews.create' ])->name('shop.reviews.create'); - // Show Product Review Form Store + // Store product review. Route::post('/product/{slug}/review', 'Webkul\Shop\Http\Controllers\ReviewController@store')->defaults('_config', [ 'redirect' => 'shop.home.index' ])->name('shop.reviews.store'); - // Download file or image + /** + * Downloadable products. + */ + Route::get('/downloadable/download-sample/{type}/{id}', 'Webkul\Shop\Http\Controllers\ProductController@downloadSample')->name('shop.downloadable.download_sample'); + Route::get('/product/{id}/{attribute_id}', 'Webkul\Shop\Http\Controllers\ProductController@download')->defaults('_config', [ 'view' => 'shop.products.index' ])->name('shop.product.file.download'); + /** + * These are the routes which are used during checkout for checking the customer. + * So, placed outside the cart merger middleware. + */ Route::prefix('customer')->group(function () { - // for customer login checkout + // For customer exist check. Route::post('/customer/exist', 'Webkul\Shop\Http\Controllers\OnepageController@checkExistCustomer')->name('customer.checkout.exist'); - // for customer login checkout + // For customer login checkout. Route::post('/customer/checkout/login', 'Webkul\Shop\Http\Controllers\OnepageController@loginForCheckout')->name('customer.checkout.login'); }); @@ -134,181 +154,187 @@ Route::group(['middleware' => ['web', 'locale', 'theme', 'currency']], function * Customer routes. */ Route::prefix('customer')->group(function () { - // forgot Password Routes - // Forgot Password Form Show + /** + * Forgot password routes. + */ + // Show forgot password form. Route::get('/forgot-password', 'Webkul\Customer\Http\Controllers\ForgotPasswordController@create')->defaults('_config', [ 'view' => 'shop::customers.signup.forgot-password' ])->name('customer.forgot-password.create'); - // Forgot Password Form Store + // Store forgot password. Route::post('/forgot-password', 'Webkul\Customer\Http\Controllers\ForgotPasswordController@store')->name('customer.forgot-password.store'); - // Reset Password Form Show + // Reset password form. Route::get('/reset-password/{token}', 'Webkul\Customer\Http\Controllers\ResetPasswordController@create')->defaults('_config', [ 'view' => 'shop::customers.signup.reset-password' ])->name('customer.reset-password.create'); - // Reset Password Form Store + // Store reset password. Route::post('/reset-password', 'Webkul\Customer\Http\Controllers\ResetPasswordController@store')->defaults('_config', [ 'redirect' => 'customer.profile.index' ])->name('customer.reset-password.store'); - // Login Routes - // Login form show + /** + * Login routes. + */ + // Login form. Route::get('login', 'Webkul\Customer\Http\Controllers\SessionController@show')->defaults('_config', [ 'view' => 'shop::customers.session.index', ])->name('customer.session.index'); - // Login form store + // Login. Route::post('login', 'Webkul\Customer\Http\Controllers\SessionController@create')->defaults('_config', [ 'redirect' => 'customer.profile.index' ])->name('customer.session.create'); - // Registration Routes - //registration form show + /** + * Registration routes. + */ + // Show registration form. Route::get('register', 'Webkul\Customer\Http\Controllers\RegistrationController@show')->defaults('_config', [ 'view' => 'shop::customers.signup.index' ])->name('customer.register.index'); - //registration form store + // Store new registered user. Route::post('register', 'Webkul\Customer\Http\Controllers\RegistrationController@create')->defaults('_config', [ 'redirect' => 'customer.session.index', ])->name('customer.register.create'); - //verify account + // Verify account. Route::get('/verify-account/{token}', 'Webkul\Customer\Http\Controllers\RegistrationController@verifyAccount')->name('customer.verify'); - //resend verification email + // Resend verification email. Route::get('/resend/verification/{email}', 'Webkul\Customer\Http\Controllers\RegistrationController@resendVerificationEmail')->name('customer.resend.verification-email'); - // Auth Routes + /** + * Customer authented routes. All the below routes only be accessible + * if customer is authenticated. + */ Route::group(['middleware' => ['customer']], function () { - - //Customer logout + /** + * Logout. + */ Route::get('logout', 'Webkul\Customer\Http\Controllers\SessionController@destroy')->defaults('_config', [ 'redirect' => 'customer.session.index' ])->name('customer.session.destroy'); - //Customer Wishlist add + /** + * Wishlist. + */ Route::post('wishlist/add/{id}', 'Webkul\Customer\Http\Controllers\WishlistController@add')->name('customer.wishlist.add'); - //Customer Wishlist remove Route::delete('wishlist/remove/{id}', 'Webkul\Customer\Http\Controllers\WishlistController@remove')->name('customer.wishlist.remove'); - //Customer Wishlist remove Route::delete('wishlist/removeall', 'Webkul\Customer\Http\Controllers\WishlistController@removeAll')->name('customer.wishlist.removeall'); - //Customer Wishlist move to cart Route::get('wishlist/move/{id}', 'Webkul\Customer\Http\Controllers\WishlistController@move')->name('customer.wishlist.move'); - //customer account + /** + * Customer account. All the below routes are related to + * customer account details. + */ Route::prefix('account')->group(function () { - //Customer Dashboard Route + /** + * Dashboard. + */ Route::get('index', 'Webkul\Customer\Http\Controllers\AccountController@index')->defaults('_config', [ 'view' => 'shop::customers.account.index' ])->name('customer.account.index'); - //Customer Profile Show + /** + * Profile. + */ Route::get('profile', 'Webkul\Customer\Http\Controllers\CustomerController@index')->defaults('_config', [ 'view' => 'shop::customers.account.profile.index' ])->name('customer.profile.index'); - //Customer Profile Edit Form Show Route::get('profile/edit', 'Webkul\Customer\Http\Controllers\CustomerController@edit')->defaults('_config', [ 'view' => 'shop::customers.account.profile.edit' ])->name('customer.profile.edit'); - //Customer Profile Edit Form Store Route::post('profile/edit', 'Webkul\Customer\Http\Controllers\CustomerController@update')->defaults('_config', [ 'redirect' => 'customer.profile.index' ])->name('customer.profile.store'); - //Customer Profile Delete Form Store Route::post('profile/destroy', 'Webkul\Customer\Http\Controllers\CustomerController@destroy')->defaults('_config', [ 'redirect' => 'customer.profile.index' ])->name('customer.profile.destroy'); - /* Profile Routes Ends Here */ - - /* Routes for Addresses */ - //Customer Address Show + /** + * Addresses. + */ Route::get('addresses', 'Webkul\Customer\Http\Controllers\AddressController@index')->defaults('_config', [ 'view' => 'shop::customers.account.address.index' ])->name('customer.address.index'); - //Customer Address Create Form Show Route::get('addresses/create', 'Webkul\Customer\Http\Controllers\AddressController@create')->defaults('_config', [ 'view' => 'shop::customers.account.address.create' ])->name('customer.address.create'); - //Customer Address Create Form Store Route::post('addresses/create', 'Webkul\Customer\Http\Controllers\AddressController@store')->defaults('_config', [ 'view' => 'shop::customers.account.address.address', 'redirect' => 'customer.address.index' ])->name('customer.address.store'); - //Customer Address Edit Form Show Route::get('addresses/edit/{id}', 'Webkul\Customer\Http\Controllers\AddressController@edit')->defaults('_config', [ 'view' => 'shop::customers.account.address.edit' ])->name('customer.address.edit'); - //Customer Address Edit Form Store Route::put('addresses/edit/{id}', 'Webkul\Customer\Http\Controllers\AddressController@update')->defaults('_config', [ 'redirect' => 'customer.address.index' ])->name('customer.address.update'); - //Customer Address Make Default Route::get('addresses/default/{id}', 'Webkul\Customer\Http\Controllers\AddressController@makeDefault')->name('make.default.address'); - //Customer Address Delete Route::delete('addresses/delete/{id}', 'Webkul\Customer\Http\Controllers\AddressController@destroy')->name('address.delete'); - /* Wishlist route */ - //Customer wishlist(listing) + /** + * Wishlist. + */ Route::get('wishlist', 'Webkul\Customer\Http\Controllers\WishlistController@index')->defaults('_config', [ 'view' => 'shop::customers.account.wishlist.wishlist' ])->name('customer.wishlist.index'); - /* Orders route */ - //Customer orders(listing) + /** + * Orders. + */ Route::get('orders', 'Webkul\Shop\Http\Controllers\OrderController@index')->defaults('_config', [ 'view' => 'shop::customers.account.orders.index' ])->name('customer.orders.index'); - //Customer downloadable products(listing) - Route::get('downloadable-products', 'Webkul\Shop\Http\Controllers\DownloadableProductController@index')->defaults('_config', [ - 'view' => 'shop::customers.account.downloadable_products.index' - ])->name('customer.downloadable_products.index'); - - //Customer downloadable products(listing) - Route::get('downloadable-products/download/{id}', 'Webkul\Shop\Http\Controllers\DownloadableProductController@download')->defaults('_config', [ - 'view' => 'shop::customers.account.downloadable_products.index' - ])->name('customer.downloadable_products.download'); - - //Customer orders view summary and status Route::get('orders/view/{id}', 'Webkul\Shop\Http\Controllers\OrderController@view')->defaults('_config', [ 'view' => 'shop::customers.account.orders.view' ])->name('customer.orders.view'); - //Prints invoice Route::get('orders/print/{id}', 'Webkul\Shop\Http\Controllers\OrderController@print')->defaults('_config', [ 'view' => 'shop::customers.account.orders.print' ])->name('customer.orders.print'); Route::post('/orders/cancel/{id}', 'Webkul\Shop\Http\Controllers\OrderController@cancel')->name('customer.orders.cancel'); - /* Reviews route */ - //Customer reviews + /** + * Downloadable products. + */ + Route::get('downloadable-products', 'Webkul\Shop\Http\Controllers\DownloadableProductController@index')->defaults('_config', [ + 'view' => 'shop::customers.account.downloadable_products.index' + ])->name('customer.downloadable_products.index'); + + Route::get('downloadable-products/download/{id}', 'Webkul\Shop\Http\Controllers\DownloadableProductController@download')->defaults('_config', [ + 'view' => 'shop::customers.account.downloadable_products.index' + ])->name('customer.downloadable_products.download'); + + /** + * Reviews. + */ Route::get('reviews', 'Webkul\Customer\Http\Controllers\CustomerController@reviews')->defaults('_config', [ 'view' => 'shop::customers.account.reviews.index' ])->name('customer.reviews.index'); - //Customer review delete Route::delete('reviews/delete/{id}', 'Webkul\Shop\Http\Controllers\ReviewController@destroy')->defaults('_config', [ 'redirect' => 'customer.reviews.index' ])->name('customer.review.delete'); - //Customer all review delete Route::delete('reviews/all-delete', 'Webkul\Shop\Http\Controllers\ReviewController@deleteAll')->defaults('_config', [ 'redirect' => 'customer.reviews.index' ])->name('customer.review.deleteall'); @@ -316,8 +342,14 @@ Route::group(['middleware' => ['web', 'locale', 'theme', 'currency']], function }); }); + /** + * CMS pages. + */ Route::get('page/{slug}', 'Webkul\CMS\Http\Controllers\Shop\PagePresenterController@presenter')->name('shop.cms.page'); + /** + * Fallback route. + */ Route::fallback(\Webkul\Shop\Http\Controllers\ProductsCategoriesProxyController::class . '@index') ->defaults('_config', [ 'product_view' => 'shop::products.view', diff --git a/packages/Webkul/Velocity/src/Http/front-routes.php b/packages/Webkul/Velocity/src/Http/front-routes.php index 7923b3a7b..6f8e50bfb 100644 --- a/packages/Webkul/Velocity/src/Http/front-routes.php +++ b/packages/Webkul/Velocity/src/Http/front-routes.php @@ -2,7 +2,6 @@ Route::group(['middleware' => ['web', 'locale', 'theme', 'currency']], function () { Route::namespace('Webkul\Velocity\Http\Controllers\Shop')->group(function () { - /** * Cart merger middleware. This middleware will take care of the items * which are deactivated at the time of buy now functionality. If somehow @@ -13,7 +12,14 @@ Route::group(['middleware' => ['web', 'locale', 'theme', 'currency']], function * group. */ Route::group(['middleware' => ['cart.merger']], function () { + /** + * Authenticated routes. All the routes inside this, will be passed + * by customer middleware. + */ Route::group(['middleware' => ['customer']], function () { + /** + * Customer compare products. + */ Route::get('/customer/account/comparison', 'ComparisonController@getComparisonList') ->name('velocity.customer.product.compare') ->defaults('_config', [ @@ -21,30 +27,46 @@ Route::group(['middleware' => ['web', 'locale', 'theme', 'currency']], function ]); }); + /** + * Guest compare products. + */ + Route::get('/comparison', 'ComparisonController@getComparisonList') + ->name('velocity.product.compare') + ->defaults('_config', [ + 'view' => 'shop::guest.compare.index' + ]); + Route::put('/comparison', 'ComparisonController@addCompareProduct') ->name('customer.product.add.compare'); Route::delete('/comparison', 'ComparisonController@deleteComparisonProduct') ->name('customer.product.delete.compare'); + + /** + * Categories and products. + */ + Route::get('/product-details/{slug}', 'ShopController@fetchProductDetails') + ->name('velocity.shop.product'); + + Route::get('/categorysearch', 'ShopController@search') + ->name('velocity.search.index') + ->defaults('_config', [ + 'view' => 'shop::search.search' + ]); + + Route::get('/fancy-category-details/{slug}', 'ShopController@fetchFancyCategoryDetails') + ->name('velocity.fancy.category.details'); + + Route::get('/category-details', 'ShopController@categoryDetails') + ->name('velocity.category.details'); + + Route::get('/category-products/{categoryId}', 'ShopController@getCategoryProducts') + ->name('velocity.category.products'); }); - Route::get('/product-details/{slug}', 'ShopController@fetchProductDetails') - ->name('velocity.shop.product'); - - Route::get('/categorysearch', 'ShopController@search') - ->name('velocity.search.index') - ->defaults('_config', [ - 'view' => 'shop::search.search' - ]); - - Route::get('/categories', 'ShopController@fetchCategories') - ->name('velocity.categoriest'); - - Route::get('/category-details', 'ShopController@categoryDetails') - ->name('velocity.category.details'); - - Route::get('/fancy-category-details/{slug}', 'ShopController@fetchFancyCategoryDetails')->name('velocity.fancy.category.details'); - + /** + * Cart, coupons and checkout. + */ Route::get('/mini-cart', 'CartController@getMiniCartDetails') ->name('velocity.cart.get.details'); @@ -54,19 +76,13 @@ Route::group(['middleware' => ['web', 'locale', 'theme', 'currency']], function Route::delete('/cart/remove/{id}', 'CartController@removeProductFromCart') ->name('velocity.cart.remove.product'); - Route::get('/comparison', 'ComparisonController@getComparisonList') - ->name('velocity.product.compare') - ->defaults('_config', [ - 'view' => 'shop::guest.compare.index' - ]); + Route::get('/categories', 'ShopController@fetchCategories') + ->name('velocity.categoriest'); Route::get('/items-count', 'ShopController@getItemsCount') ->name('velocity.product.item-count'); Route::get('/detailed-products', 'ShopController@getDetailedProducts') ->name('velocity.product.details'); - - Route::get('/category-products/{categoryId}', 'ShopController@getCategoryProducts') - ->name('velocity.category.products'); }); -}); \ No newline at end of file +});