wishlist
This commit is contained in:
parent
9a8bd01d4f
commit
ad4d810854
|
|
@ -5,6 +5,7 @@ namespace Sarga\API\Http\Controllers;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Sarga\API\Http\Resources\Checkout\CartResource;
|
use Sarga\API\Http\Resources\Checkout\CartResource;
|
||||||
use Sarga\API\Http\Resources\Customer\WishListResource;
|
use Sarga\API\Http\Resources\Customer\WishListResource;
|
||||||
|
use Sarga\Shop\Repositories\ProductRepository;
|
||||||
use Webkul\Checkout\Facades\Cart;
|
use Webkul\Checkout\Facades\Cart;
|
||||||
use Webkul\RestApi\Http\Controllers\V1\Shop\Customer\WishlistController;
|
use Webkul\RestApi\Http\Controllers\V1\Shop\Customer\WishlistController;
|
||||||
|
|
||||||
|
|
@ -52,10 +53,13 @@ class Wishlists extends WishlistController
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$product = app(ProductRepository::class)->find($id);
|
||||||
|
|
||||||
$wishlistItem = $this->wishlistRepository->create([
|
$wishlistItem = $this->wishlistRepository->create([
|
||||||
'channel_id' => core()->getCurrentChannel()->id,
|
'channel_id' => core()->getCurrentChannel()->id,
|
||||||
'product_id' => $id,
|
'product_id' => $id,
|
||||||
'customer_id' => $customer->id,
|
'customer_id' => $customer->id,
|
||||||
|
'price' => $product->min_price
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return response([
|
return response([
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ Route::group(['prefix' => 'api'], function () {
|
||||||
// ]);
|
// ]);
|
||||||
|
|
||||||
//Product routes
|
//Product routes
|
||||||
Route::get('products', [Products::class, 'index']);//->middleware('cacheResponse:3600');
|
Route::get('products', [Products::class, 'index'])->middleware('cacheResponse:3600');
|
||||||
Route::get('products-discounted', [Products::class, 'discountedProducts'])->middleware('cacheResponse:3600');
|
Route::get('products-discounted', [Products::class, 'discountedProducts'])->middleware('cacheResponse:3600');
|
||||||
Route::get('products-popular', [Products::class, 'popularProducts'])->middleware('cacheResponse:3600');
|
Route::get('products-popular', [Products::class, 'popularProducts'])->middleware('cacheResponse:3600');
|
||||||
Route::get('products-search', [Products::class, 'searchProducts'])->middleware('cacheResponse:3600');
|
Route::get('products-search', [Products::class, 'searchProducts'])->middleware('cacheResponse:3600');
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class AddPriceCloumnInWishlistTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('wishlist', function (Blueprint $table) {
|
||||||
|
$table->unsignedDecimal('price',12,4)->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('wishlist', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('price');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue