how do I restore a value of a Session object in the Laravel?

Asked

Viewed 159 times

1

hello,

I have this Session object and cannot access the arrays. How do I? Itero? Which loop would you use to have a certain arrays position?

Cart {#268 ▼
    -items: array:2 [▼
    2 => array:5 [▶]
    1 => array:5 [▶]
    ]
    #connection: null
    #table: null
    #primaryKey: "id"
    #keyType: "int"
    #perPage: 15
    +incrementing: true
    +timestamps: true
    #attributes: []
    #original: []
    #relations: []
    #hidden: []
    #visible: []
    #appends: []
    #fillable: []
    #guarded: array:1 [▶]
    #dates: []
    #dateFormat: null
    #casts: []
    #touches: []
    #observables: []
    #with: []
    +exists: false
    +wasRecentlyCreated: false
}
  • Put the class in your question or if the package provides the configuration

2 answers

0

  • I need to do this in a variable for another action but I’m not able to access the object items as I do?

  • You want to restore the value of an object as in the question title or access the property(s))?

  • I need to access it because I’m in the action because I’m using Session in another class. I’m recovering Collection but I can’t access it

0

I found the bug, the property written -items is a private array, when the makes public can be accessible by showing as a positive sign.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.