In this tutorial, We will learn how to get session data in laravel 7 . You can get session data in laravel.


Example:



public function index() {
    $cart[$id] = [
        "name" => "computer",
        "quantity" => 10,
        "price" => 1000$,
    ];

    session(['cart' => $cart]);
}


Thanks, May this example will help you.