Hey how are you?
You can use the user ID to make login:
Auth::loginUsingId($userId)
what do you think?
You can read about that on this page:
https://laravel.com/docs/5.6/authentication#other-authentication-methods
cya.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have a website where i assign the current session id to a cart instance I want to be able to access a specific session ID, find in it the "cart" instance and remove the "cart" parameter.
Reason: payment callbacks (IPN's/webHooks) should be able to clear the items of a user cart whenever the callback takes place, as not all users return after payment back to the origin website.
I solved the problem by using a Mutator:
https://laravel.com/docs/5.6/eloquent-mutators
In my order model:
public function getCartAttribute($cart) {
return unserialize($cart);
}
This mutator is required to unserialize().
For some reason without the mutator i get errors like:
laravel unserialize(): Error at offset 0 of 2302 bytes
Then in the success (regardless if the callback response is success/failed, as it is only to test) i do:
public function success()
{
$order = Order::find(12);
new Cart($order->cart);
session(['cart' => $order->cart]);
return view('success');
}
The cart is now filled-Up again with the previous products!!!!!!!!!!!!!!!!!!!!!!!!!
Perhaps this can also help someone else!
Please or to participate in this conversation.