1
<?php
2

3
namespace Nuwave\Lighthouse\Defer;
4

5
use Illuminate\Contracts\Events\Dispatcher;
6
use Illuminate\Support\ServiceProvider;
7
use Nuwave\Lighthouse\Events\ManipulateAST;
8
use Nuwave\Lighthouse\Events\RegisterDirectiveNamespaces;
9
use Nuwave\Lighthouse\Schema\DirectiveLocator;
10
use Nuwave\Lighthouse\Support\Contracts\CreatesResponse;
11

12
class DeferServiceProvider extends ServiceProvider
13
{
14
    /**
15
     * Bootstrap any application services.
16
     */
17 1
    public function boot(DirectiveLocator $directiveFactory, Dispatcher $dispatcher): void
18
    {
19 1
        $dispatcher->listen(
20 1
            RegisterDirectiveNamespaces::class,
21
            function (RegisterDirectiveNamespaces $registerDirectiveNamespaces): string {
22 1
                return __NAMESPACE__;
23
            }
24
        );
25

26 1
        $dispatcher->listen(
27 1
            ManipulateAST::class,
28 1
            Defer::class.'@handleManipulateAST'
29
        );
30
    }
31

32
    /**
33
     * Register any application services.
34
     */
35 1
    public function register(): void
36
    {
37 1
        $this->app->singleton(Defer::class);
38

39 1
        $this->app->singleton(CreatesResponse::class, Defer::class);
40
    }
41
}

Read our documentation on viewing source code .

Loading