In this video we are going to learn about Http Session in Laravel.
All HTTP driven applications are stateless.
Sessions provide a way to store information about the user across multiple requests.
Laravel provides various drivers like file, cookie,array, Redis, and database to handle session data.
By default, file driver is used because it is lightweight.
Session can be configured using its configuration file.
So lets see the session configuration file.
Go to the project and open config folder.
Inside the config directory you can see the session.php file.
Just open this.
Here you can session related configuration.
Let see how can we use session in laravel 8.
For that, Lets Create a controller.
So switch to the command prompt and run the following command.

php artisan make:controller SessionController

Now lets open the SessionController file and here create a function.

public function getSessionData(Request $request)
{
if($request->session()->has('name'))
{
echo $request->session()->get('name');
}
else
{
echo 'No data in the session';
}
}


Now create another method for Storing Session Data.

public function storeSessionData(Request $request) {
$request->session()->put(name','Jenifer');
echo \"Data has been added to session\";
}


Now create another method for deleting session data.

public function deleteSessionData(Request $request) {
$request->session()->forget('my_name');
echo \"Data has been removed from session.\";
}


Ok now create the routes for these methods.
So just go to the web.php and create routes.

Route::get('session/get',[SessionController::class,'accessSessionData');
Route::get('session/set',[SessionController::class,'storeSessionData');
Route::get('session/remove',[SessionController::class,'deleteSessionData');


Now lets check so goto the browser and here for set the session.
So go to the url
http://localhost:8000/session/set
Ok now you can see the message.
Session created Now get the session data go to the url.
http://localhost:8000/session/get
and you can see the store session data which is name jenifer.
and in last just remove the session data so type.
http://localhost:8000/session/remove

So in this way you can use Http Session in Laravel 8.