Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

bajro17's avatar

Laravel 5.3 session don't want to delete

I try to make cart with session and now I cant delete it even if I do php artisan cache:clear its still there

0 likes
4 replies
bajro17's avatar

I fix this my bad I use file but now I need help how to reduce items I making cart this is my: store function where I add product in cart

public function store($id)
    {
      $product = Product::find($id);

      Session::push('korpa', $product);

      return back();

    }

how to reduce now I try with Session::pull($product, 'korpa'); this dont work

bajro17's avatar

I fix this too :) if someone need it I will put all here

  public function store($id)
    {
      $product = Product::find($id);
      
      Session::push('korpa', $product);

      return back();

    }

and my delete function

  public function destroy( $id)
    {
          Session::pull('korpa.'.$id);
        return back();
    }
bajro17's avatar

I just now need when I add item in cart it add new instance even if same item how to just update quantity

Please or to participate in this conversation.