How to Deleting Session Data in Laravel ?

Answers were Sorted based on User's Feedback



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

How to Deleting Session Data in Laravel ?..

Answer / Amod Kumar Singh

To delete session data in Laravel, you can use the `session()` helper function and the `forget()` method. For example, `Session::forget('key');` will remove the data associated with the specified key.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Laravel PHP Framework Interview Questions

What is laravel 5 homestead?

1 Answers  


What is php artisan serve in laravel?

1 Answers  


What is tinker in laravel?

1 Answers  


What is mvc framework?

1 Answers  


What is console in laravel?

1 Answers  


Explain web.php route.

1 Answers  


How install react js in laravel?

1 Answers  


List types of relationships available in laravel eloquent?

1 Answers  


Please explain the difference between laravel and codeigniter?

1 Answers  


What is official website url of laravel?

1 Answers  


Explain extending bindings?

1 Answers  


What is the best package to set up billing and subscription with stripe and braintree?

1 Answers  


Categories