Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: Delete item from session in laravel 5.4

rodrigo1990:

I have this code to push products into array session in Laravel 5.4


public function agregarACarrito(Request $request)
{
$producto = new Producto();

$producto = Producto::with('marca')
->where('id', '=', $request->parametros)
->get();

$request->session()->push('session_products', $producto);
}

So, i want to Delete an item using AJAX, this is my code right now, doing this, the respond is always the default value:


public function borrarDeCarrito(Request $request)
{
$value = $request->session()->pull($request->parametros, 'default');

return $value;
}

And if i try this


$value = $request->session()->get('session_products')->pull($request->parametros, 'default');

return $value;

I get a 500 internal server error

¿what i'm doing wrong ?



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered
HERE


This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: Delete item from session in laravel 5.4

×

Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription

×