How to Deleting Session Data in Laravel ?



How to Deleting Session Data in Laravel ?..

Answer / amit khanna

The forget() method is used to delete an item from the session.
This method will take key as the argument.

Syntax : $request->session()->forget('key');

Use flush() method instead of forget() method to delete all session data.
Use the pull() method to retrieve data from session and delete it afterwards.
The pull() method will also take key as the argument.
The difference between the forget() and the pull() method is that forget() method will not return the value of the session and pull() method will return it and delete that value from session.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Laravel PHP Framework Interview Questions

What are view composers?

0 Answers  


What is a caas?

0 Answers  


What is a flush() ?

0 Answers  


How can someone change the default database type in laravel?

0 Answers  


How to create custom middleware in laravel?

0 Answers  






What is tinker in laravel?

0 Answers  


Explain how to serve sites with tls on valet?

0 Answers  


What is meant by Authorization Mechanism in Laravel ?

1 Answers  


What are system requirement for laravel 5.0?

0 Answers  


What is facades in laravel?

0 Answers  


What is meant by url in internet?

0 Answers  


explain how to add a middleware in route group?

0 Answers  


Categories