Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get all carts for analysis #362

Open
ZainabEid opened this issue Mar 18, 2023 · 0 comments
Open

How to get all carts for analysis #362

ZainabEid opened this issue Mar 18, 2023 · 0 comments

Comments

@ZainabEid
Copy link

ZainabEid commented Mar 18, 2023

Hi
I need to get all carts from database and view their details with conditions and item details ?
when using eloquent model and get all carts pluck id to get the session id it returns a different number !
this is the logic I am trying to apply

public function getAll(){
 $all_carts_in_db =CartStorage::get();
  $carts=[];
   foreach ($all_carts_in_db as $cart_in_db ){
        $sessionKey=str_replace('_cart_items', '', $cart_in_db->id);
      $carts[]= Cart::session($sessionKey);
  }
return $carts;
}

the issue is the when I am trying to get the cart session key , $cart_in_db->id returns new number

the session Key I have entered is 51546e31-a956-4876-ab3d-33413d06d826-8g0W30LdUrk2hlte6zdbqCFMc6MyrmTM-c6daeb8549b1d1ce75ac4074d0ba305f

in database id is 51546e31-a956-4876-ab3d-33413d06d826-8g0W30LdUrk2hlte6zdbqCFMc6MyrmTM-c6daeb8549b1d1ce75ac4074d0ba305f_cart_items

the returned value from $cart_in_db->id is 9223372036854775807

I expected that $cart_in_db->id equals the id in the database

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant