How to Get Session Data In Laravel ?




Hi Guys,

In this example,I will learn you how to get session data in can easy and simply get session data in laravel.

In a programming language, session is a great way to store data. It makes easy to handle data without storing in a database.

Session is useful to protect the data that the user wouldn't be able to read or write. Sessions are easier and secure cookies. Sessions are useful user logins, carts etc.


public function index()


$cart[$id] = [

"name" => "Mobile",

"quantity" => 10,

"price" => 10000,


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


It will help you...

#Laravel 8

#Laravel 7


#Laravel 6