2021-10-27 16:06:17 +00:00
|
|
|
<?php
|
2021-10-27 17:13:21 +00:00
|
|
|
|
2021-12-04 17:28:11 +00:00
|
|
|
use Illuminate\Support\Facades\Route;
|
2022-02-03 08:34:16 +00:00
|
|
|
use Sarga\API\Http\Controllers\Addresses;
|
2022-01-24 12:20:46 +00:00
|
|
|
use Sarga\API\Http\Controllers\Customers;
|
2021-10-27 17:13:21 +00:00
|
|
|
use Sarga\API\Http\Controllers\Categories;
|
2021-10-27 16:06:17 +00:00
|
|
|
use Sarga\API\Http\Controllers\Channels;
|
2021-12-10 14:30:26 +00:00
|
|
|
use Sarga\API\Http\Controllers\IntegrationController;
|
2021-12-04 17:28:11 +00:00
|
|
|
use Sarga\API\Http\Controllers\Vendors;
|
2021-11-09 17:55:21 +00:00
|
|
|
use Sarga\API\Http\Controllers\Products;
|
2021-12-30 04:31:36 +00:00
|
|
|
use Sarga\Shop\Repositories\CategoryRepository;
|
2021-10-28 16:36:04 +00:00
|
|
|
use Webkul\API\Http\Controllers\Shop\ResourceController;
|
|
|
|
|
use Webkul\Attribute\Repositories\AttributeOptionRepository;
|
|
|
|
|
use Sarga\API\Http\Resources\Catalog\AttributeOption;
|
2021-12-30 04:31:36 +00:00
|
|
|
use Sarga\API\Http\Resources\Catalog\Category;
|
2022-01-27 15:07:05 +00:00
|
|
|
use Webkul\Core\Repositories\CountryStateRepository;
|
2021-10-27 16:06:17 +00:00
|
|
|
|
2022-02-03 08:34:16 +00:00
|
|
|
Route::group(['prefix' => 'api'], function () {
|
|
|
|
|
Route::group(['middleware' => ['locale', 'currency']], function () {
|
2021-10-27 16:06:17 +00:00
|
|
|
//Channel routes
|
|
|
|
|
Route::get('channels',[Channels::class, 'index']);
|
2021-10-27 17:13:21 +00:00
|
|
|
|
2021-12-04 17:28:11 +00:00
|
|
|
//Vendors
|
2022-01-19 14:04:47 +00:00
|
|
|
Route::get('vendors',[Vendors::class,'index'])->name('api.vendors');
|
2022-01-28 10:01:59 +00:00
|
|
|
Route::get('vendor/products/{vendor_id}',[Vendors::class,'products'])->name('api.vendor.products');
|
|
|
|
|
Route::get('vendor/brands/{vendor_id}',[Vendors::class,'brands'])->name('api.vendor.brands');
|
2022-01-19 14:04:47 +00:00
|
|
|
|
2021-10-27 17:13:21 +00:00
|
|
|
//category routes
|
2021-12-30 04:31:36 +00:00
|
|
|
Route::get('descendant-categories', [Categories::class, 'index'])->name('api.descendant-categories');
|
2022-01-15 18:07:58 +00:00
|
|
|
Route::get('category-details/{id}', [Categories::class, 'details']);
|
2021-12-30 04:31:36 +00:00
|
|
|
Route::get('categories', [ResourceController::class, 'index'])->defaults('_config', [
|
|
|
|
|
'repository' => CategoryRepository::class,
|
|
|
|
|
'resource' => Category::class,
|
|
|
|
|
])->name('api.categories');
|
2022-02-01 09:35:16 +00:00
|
|
|
Route::get('categories/{id}/filters',[Categories::class,'filters']);
|
2022-02-03 08:34:16 +00:00
|
|
|
|
2021-10-28 15:30:35 +00:00
|
|
|
//attributes by code
|
2021-10-28 16:36:04 +00:00
|
|
|
Route::get('attribute-options', [ResourceController::class, 'index'])->defaults('_config', [
|
|
|
|
|
'repository' => AttributeOptionRepository::class,
|
|
|
|
|
'resource' => AttributeOption::class,
|
2021-10-28 15:30:35 +00:00
|
|
|
]);
|
|
|
|
|
|
2021-11-09 17:55:21 +00:00
|
|
|
//Product routes
|
|
|
|
|
Route::get('products', [Products::class, 'index']);
|
|
|
|
|
Route::get('products/{id}', [Products::class, 'get']);
|
2022-01-21 10:22:27 +00:00
|
|
|
Route::get('products/{id}/variants', [Products::class, 'variants']);
|
2022-01-27 15:07:05 +00:00
|
|
|
|
|
|
|
|
Route::get('states', [ResourceController::class, 'index'])->defaults('_config', [
|
|
|
|
|
'repository' => CountryStateRepository::class,
|
|
|
|
|
'resource' => Category::class,
|
|
|
|
|
]);
|
2021-10-27 16:06:17 +00:00
|
|
|
});
|
2021-12-06 11:52:58 +00:00
|
|
|
|
2022-02-03 08:34:16 +00:00
|
|
|
//scrap
|
|
|
|
|
Route::group(['prefix' => 'scrap','middleware' =>['scrap']], function (){
|
2021-12-10 14:30:26 +00:00
|
|
|
Route::put('upload',[IntegrationController::class,'bulk_upload']);
|
2021-12-18 20:20:59 +00:00
|
|
|
Route::put('create',[IntegrationController::class,'create']);
|
2021-12-06 11:52:58 +00:00
|
|
|
});
|
2022-01-24 12:20:46 +00:00
|
|
|
|
2022-02-03 08:34:16 +00:00
|
|
|
//customer
|
|
|
|
|
Route::group(['prefix' => 'customer'],function (){
|
2022-01-25 07:25:49 +00:00
|
|
|
Route::post('register', [Customers::class, 'register']);
|
|
|
|
|
Route::post('login', [Customers::class, 'login']);
|
2022-02-03 08:34:16 +00:00
|
|
|
Route::group(['middleware' => ['auth:sanctum', 'sanctum.customer']], function () {
|
|
|
|
|
Route::put('profile', [Customers::class, 'update']);
|
|
|
|
|
/**
|
|
|
|
|
* Customer address routes.
|
|
|
|
|
*/
|
|
|
|
|
Route::get('addresses', [Addresses::class, 'index']);
|
2022-02-07 14:30:10 +00:00
|
|
|
Route::post('addresses', [Addresses::class, 'createAddress']);
|
|
|
|
|
Route::put('addresses/{id}', [Addresses::class, 'updateAddress']);
|
2022-02-03 08:34:16 +00:00
|
|
|
Route::delete('addresses/{id}', [Addresses::class, 'destroy']);
|
2022-02-07 14:30:10 +00:00
|
|
|
/**
|
|
|
|
|
* Recipients
|
|
|
|
|
*/
|
|
|
|
|
Route::get('recipients', [Addresses::class, 'recipients']);
|
|
|
|
|
Route::post('recipients', [Addresses::class, 'createRecipient']);
|
|
|
|
|
Route::put('recipients/{id}', [Addresses::class, 'updateRecipient']);
|
|
|
|
|
Route::delete('recipients/{id}', [Addresses::class, 'destroy']);
|
2022-02-03 08:34:16 +00:00
|
|
|
});
|
2022-01-25 07:25:49 +00:00
|
|
|
});
|
|
|
|
|
|
2021-10-27 16:06:17 +00:00
|
|
|
});
|