File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -599,8 +599,50 @@ $this->app['wishlist'] = $this->app->share(function($app)
599599 $session_key
600600 );
601601 });
602+
603+ // for 5.4 or newer
604+ use Darryldecode\Cart\Cart;
605+ use Illuminate\Support\ServiceProvider;
606+
607+ class WishListProvider extends ServiceProvider
608+ {
609+ /**
610+ * Bootstrap the application services.
611+ *
612+ * @return void
613+ */
614+ public function boot()
615+ {
616+ //
617+ }
618+ /**
619+ * Register the application services.
620+ *
621+ * @return void
622+ */
623+ public function register()
624+ {
625+ $this->app->singleton('wishlist', function($app)
626+ {
627+ $storage = $app['session'];
628+ $events = $app['events'];
629+ $instanceName = 'cart_2';
630+ $session_key = '88uuiioo99888';
631+ return new Cart(
632+ $storage,
633+ $events,
634+ $instanceName,
635+ $session_key,
636+ config('shopping_cart')
637+ );
638+ });
639+ }
640+ }
602641```
603642
643+ IF you are having problem with multiple cart instance, please see the codes on
644+ this demo repo here: [ DEMO] ( https://github.com/darryldecode/laravelshoppingcart-demo )
645+
604646## Exceptions
605647
606648There are currently only two exceptions.
You can’t perform that action at this time.
0 commit comments