Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To remove an item from the Laravel session, you can use the forget method of the Session facade.

Example:

// Assuming you have already started the session using the `session` helper or facade

// Add an item to the session
session()->put('key', 'value');

// Remove the item from the session
session()->forget('key');

The forget method takes the key of the item you want to remove as its parameter. If the key does not exist in the session, calling the forget method has no effect.