AppServiceProvider.php 1.82 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;
Jacob Priddy's avatar
Jacob Priddy committed
7
use Source\Gateways\Tokens\TokensRepositoryServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
8
use Source\UseCases\Users\GetUser\GetUserUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
9
use Source\UseCases\Users\CreateUser\CreateUserUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
10
use Source\UseCases\Users\DeleteUser\DeleteUserUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
11
use Source\UseCases\Users\UpdateUser\UpdateUserUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
12
use Source\UseCases\Users\GetAllUsers\GetAllUsersUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
13
use Source\UseCases\Token\Authenticate\AuthenticateUseCaseServiceProvider;
14
15
16

class AppServiceProvider extends ServiceProvider
{
17
18
19
20
21

    /**
     * @var string[]
     */
    protected array $gatewayProviders = [
Jacob Priddy's avatar
Jacob Priddy committed
22
        UsersRepositoryServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
23
        TokensRepositoryServiceProvider::class,
24
25
26
27
28
29
    ];

    /**
     * @var string[]
     */
    protected array $useCaseProviders = [
Jacob Priddy's avatar
Jacob Priddy committed
30
        GetUserUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
31
        DeleteUserUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
32
        UpdateUserUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
33
        CreateUserUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
34
        GetAllUsersUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
35
36

        AuthenticateUseCaseServiceProvider::class,
37
38
    ];

39
40
41
42
43
44
45
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
46
47
48
49
50
51
52
53
        // 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);
        }
54
55
56
57
58
59
60
61
62
63
64
65
    }

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