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 is a Laravel - Contracts ?

0 Answers  


How to add multiple and conditions in laravel query?

0 Answers  


Is laravel a cms?

0 Answers  


Why do we use laravel?

0 Answers  


Explain the bindings and singletons properties?

0 Answers  


What is blade php in laravel?

0 Answers  


Explain what is valet?

0 Answers  


What is laravel service provider?

0 Answers  


List some aggregates methods provided by query builder in laravel?

0 Answers  


What is a repl?

0 Answers  


How install react js in laravel?

0 Answers  


What are pros and cons of using laravel framework?

0 Answers  


Categories