Merge branch 'main' into faiqahzaman
This commit is contained in:
@@ -36,31 +36,19 @@ class CartController extends Controller
|
||||
|
||||
public function getCart($userid)
|
||||
{
|
||||
$carts = Cart::where('user_id','=', $userid)->get();
|
||||
$carts = Cart::where('user_id','=', $userid)->get()->toArray();
|
||||
|
||||
foreach($carts as $cart)
|
||||
foreach($carts as $index => $cart)
|
||||
{
|
||||
$arraycart = [];
|
||||
$lelongbid = LelongBid::where('id',$cart->lelongbid_id)->first();
|
||||
$marhun = LelongBidMarhun::where('lelongbid_id','=',$lelongbid->id)->get();
|
||||
$lelongbid->marhun = $marhun;
|
||||
$cart->lelongbid = $lelongbid;
|
||||
$lelongbid = LelongBid::where('id',$cart['lelongbid_id'])->first()->toArray();
|
||||
$marhun = LelongBidMarhun::where('lelongbid_id','=',$lelongbid['id'])->get()->toArray();
|
||||
|
||||
$carts[$index]['datalelongbid'] = $lelongbid;
|
||||
$carts[$index]['datalelongbid']['lelongbidmarhun'] = $marhun;
|
||||
}
|
||||
|
||||
if(sizeof($carts)!=0)
|
||||
{
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'carts' => $carts
|
||||
]);
|
||||
}
|
||||
else
|
||||
{
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'No Data',
|
||||
], 401);
|
||||
}
|
||||
|
||||
return response()->json($carts);
|
||||
}
|
||||
|
||||
public function addToCart(Request $request)
|
||||
@@ -72,19 +60,9 @@ class CartController extends Controller
|
||||
|
||||
if($item->save())
|
||||
{
|
||||
$carts = Cart::where('user_id','=', $request->user_id)->get();
|
||||
|
||||
foreach($carts as $cart)
|
||||
{
|
||||
$arraycart = [];
|
||||
$lelongbid = LelongBid::where('id',$cart->lelongbid_id)->first();
|
||||
$marhun = LelongBidMarhun::where('lelongbid_id','=',$lelongbid->id)->get();
|
||||
$lelongbid->marhun = $marhun;
|
||||
$cart->lelongbid = $lelongbid;
|
||||
}
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'carts' => $carts
|
||||
'carts' => $item
|
||||
]);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -5,6 +5,7 @@ use Illuminate\Support\Facades\Route;
|
||||
use App\Http\Controllers\AuthMobile\AuthController;
|
||||
use App\Http\Controllers\AuthMobile\UserController;
|
||||
use App\Http\Controllers\AuthMobile\LelongMobileController;
|
||||
use App\Http\Controllers\CartController;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user