File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -13,14 +13,14 @@ public function __construct()
1313 $ this ->items = collect ();
1414
1515 if (session ()->has ('cart ' )) {
16- $ this ->items = session ('cart ' )-> items ;
16+ $ this ->items = session ('cart ' );
1717 }
1818 }
1919
2020 public function add ($ product , $ key )
2121 {
2222 $ this ->items ->put ($ key , $ product );
23- session ()->put ('cart ' , $ this );
23+ session ()->put ('cart ' , $ this -> items );
2424 }
2525
2626 public function totalPrice ()
Original file line number Diff line number Diff line change 33namespace App \Providers ;
44
55use App \Contracts \PaymentContract ;
6+ use App \Models \Cart ;
67use App \Models \StripePayment ;
8+ use Illuminate \Support \Facades \View ;
79use Illuminate \Support \ServiceProvider ;
810
911class AppServiceProvider extends ServiceProvider
@@ -15,7 +17,7 @@ class AppServiceProvider extends ServiceProvider
1517 */
1618 public function register ()
1719 {
18- $ this ->app ->bind (PaymentContract::class, StripePayment::class);
20+ // $this->app->bind(PaymentContract::class, StripePayment::class);
1921 }
2022
2123 /**
@@ -25,6 +27,10 @@ public function register()
2527 */
2628 public function boot ()
2729 {
28- //
30+ $ this ->app ->bind ('App\Contracts\PaymentContract ' , 'App\Models\StripePayment ' );
31+
32+ View::composer ('layouts.app ' , function ($ view ) {
33+ $ view ->with (['cart ' => new Cart ()]);
34+ });
2935 }
3036}
You can’t perform that action at this time.
0 commit comments