0👍
If you want access from multiple methods on your controller the simplest way is to use dependency injection in the constructor of your controller.
protected $cart;
public function __construct(Cart $cart)
{
$this->cart = $cart;
}
Then in your various controller methods you can simply access it like
$this->cart->add()
Source:stackexchange.com