AppServiceProvider.php 2.26 KB
Newer Older
1
2
3
4
5
<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
6
use Source\Gateways\Users\UsersRepositoryServiceProvider;
7
use Source\Gateways\Doors\DoorsRepositoryServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
8
use Source\Gateways\Tokens\TokensRepositoryServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
9
use Source\UseCases\Users\GetUser\GetUserUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
10
use Source\UseCases\Users\CreateUser\CreateUserUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
11
use Source\UseCases\Users\DeleteUser\DeleteUserUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
12
use Source\UseCases\Users\UpdateUser\UpdateUserUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
13
use Source\UseCases\Users\GetAllUsers\GetAllUsersUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
14
use Source\UseCases\Token\Authenticate\AuthenticateUseCaseServiceProvider;
15
use Source\UseCases\Doors\Authenticate\AuthenticateUseCaseServiceProvider as DoorAuthenticateUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
16
use Source\UseCases\Users\Authenticate\AuthenticateUseCaseServiceProvider as UserAuthenticateUseCaseServiceProvider;
17
18
19

class AppServiceProvider extends ServiceProvider
{
20
21
22
23
24

    /**
     * @var string[]
     */
    protected array $gatewayProviders = [
Jacob Priddy's avatar
Jacob Priddy committed
25
        UsersRepositoryServiceProvider::class,
26
        DoorsRepositoryServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
27
        TokensRepositoryServiceProvider::class,
28
29
30
31
32
33
    ];

    /**
     * @var string[]
     */
    protected array $useCaseProviders = [
Jacob Priddy's avatar
Jacob Priddy committed
34
        GetUserUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
35
        DeleteUserUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
36
        UpdateUserUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
37
        CreateUserUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
38
        GetAllUsersUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
39
40

        AuthenticateUseCaseServiceProvider::class,
41
        DoorAuthenticateUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
42
        UserAuthenticateUseCaseServiceProvider::class,
43
44
    ];

45
46
47
48
49
50
51
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
52
53
54
55
56
57
58
59
        // We register gateways first, as use cases will generally use gateways
        foreach ($this->gatewayProviders as $gatewayProvider) {
            $this->app->registerDeferredProvider($gatewayProvider);
        }

        foreach ($this->useCaseProviders as $useCaseProvider) {
            $this->app->registerDeferredProvider($useCaseProvider);
        }
60
61
62
63
64
65
66
67
68
69
70
71
    }

    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        //
    }
}