How to Get Session Data In Laravel ?
Hi Guys,
In this example,I will learn you how to get session data in laravel.you 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.
Example:
public function index()
{
$cart[$id] = [
"name" => "Mobile",
"quantity" => 10,
"price" => 10000,
];
session(['cart' => $cart]);
}
It will help you...
- How to Notifications With database Driver in Laravel 11?
- How to Send Email Via Notification in Laravel 11?
- How to Install and Configure Laravel 11 Debugbar?
- How to Like Dislike System in Laravel 11?
- How to Paginate a Model with Relationship in Laravel 11?
- Laravel 11 Upload Files to Amazon S3 Example
- Laravel 11 Send WhatsApp Messages Example
- Laravel 11 Rest API Authentication Using JWT Tutorial