1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
- namespace App\Providers;
- use App\Billing\Stripe;
- use App\Post;
- use App\Tag;
- use Illuminate\Foundation\Application;
- use Illuminate\Support\ServiceProvider;
- class AppServiceProvider extends ServiceProvider
- {
- const STRIPE = 'billing.stripe';
- const STRIPE_KEY = 'services.stripe.key';
- protected $defer = true;
-
- public function boot()
- {
- view()->composer('layouts.sidebar', function ($view) {
- $archives = Post::archives();
- $tags = Tag::has('posts')->pluck(Tag::LABEL_KEY);
- $view->with(compact(['archives', 'tags']));
- });
- }
-
- public function register()
- {
-
-
- $app2 = $this->app;
- $this->app->bind(Stripe::class, function (Application $app) use($app2) {
-
- return new Stripe($this->app['config'][static::STRIPE_KEY]);
- });
- $this->app->alias(Stripe::class, static::STRIPE);
- }
- }
|