jeudi 22 octobre 2015

Laravel5.1: Store assosiative Array into Session

I've read the Session Docs of Laravel 5.1 - i've learned there's Session::put() and Session::push() but i want to handle the following issue:

here's my Array, which i'd define using Session::put("grids", $array);

Array
(
    [grid1] => Array
        (
            [id] => foo1
            [name] => bar1
        )

    [grid2] => Array
        (
            [id] => foo2
            [name] => bar2
        )

)

How can I directly manipulate eg. grid2 through Laravel? Usually under "normal" PHP i'd do it like this:

$_SESSION["grids"]["grid2"] = array(
    "id" => "blah1",
    "name" => "blah2"

)

do i need to delete that item then push it again or is there a simpler way? Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire