1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Omatech\Mage\Core; |
4
|
|
|
|
5
|
|
|
use Illuminate\Support\ServiceProvider; |
6
|
|
|
use Omatech\Mage\Core\Domains\Permissions\Contracts\AllPermissionInterface; |
7
|
|
|
use Omatech\Mage\Core\Domains\Permissions\Contracts\AttachedPermissionInterface; |
8
|
|
|
use Omatech\Mage\Core\Domains\Permissions\Contracts\CreatePermissionInterface; |
9
|
|
|
use Omatech\Mage\Core\Domains\Permissions\Contracts\DeletePermissionInterface; |
10
|
|
|
use Omatech\Mage\Core\Domains\Permissions\Contracts\ExistsPermissionInterface; |
11
|
|
|
use Omatech\Mage\Core\Domains\Permissions\Contracts\FindPermissionInterface; |
12
|
|
|
use Omatech\Mage\Core\Domains\Permissions\Contracts\PermissionInterface; |
13
|
|
|
use Omatech\Mage\Core\Domains\Permissions\Contracts\UniquePermissionInterface; |
14
|
|
|
use Omatech\Mage\Core\Domains\Permissions\Contracts\UpdatePermissionInterface; |
15
|
|
|
use Omatech\Mage\Core\Domains\Permissions\Permission; |
16
|
|
|
use Omatech\Mage\Core\Domains\Roles\Contracts\AllRoleInterface; |
17
|
|
|
use Omatech\Mage\Core\Domains\Roles\Contracts\AttachedRoleInterface; |
18
|
|
|
use Omatech\Mage\Core\Domains\Roles\Contracts\CreateRoleInterface; |
19
|
|
|
use Omatech\Mage\Core\Domains\Roles\Contracts\DeleteRoleInterface; |
20
|
|
|
use Omatech\Mage\Core\Domains\Roles\Contracts\ExistsRoleInterface; |
21
|
|
|
use Omatech\Mage\Core\Domains\Roles\Contracts\FindRoleInterface; |
22
|
|
|
use Omatech\Mage\Core\Domains\Roles\Contracts\RoleInterface; |
23
|
|
|
use Omatech\Mage\Core\Domains\Roles\Contracts\UniqueRoleInterface; |
24
|
|
|
use Omatech\Mage\Core\Domains\Roles\Contracts\UpdateRoleInterface; |
25
|
|
|
use Omatech\Mage\Core\Domains\Roles\Role; |
26
|
|
|
use Omatech\Mage\Core\Domains\Translations\Contracts\AllTranslationInterface; |
27
|
|
|
use Omatech\Mage\Core\Domains\Translations\Contracts\CreateTranslationInterface; |
28
|
|
|
use Omatech\Mage\Core\Domains\Translations\Contracts\DeleteTranslationInterface; |
29
|
|
|
use Omatech\Mage\Core\Domains\Translations\Contracts\ExistsTranslationInterface; |
30
|
|
|
use Omatech\Mage\Core\Domains\Translations\Contracts\FindTranslationInterface; |
31
|
|
|
use Omatech\Mage\Core\Domains\Translations\Contracts\TranslationInterface; |
32
|
|
|
use Omatech\Mage\Core\Domains\Translations\Contracts\UniqueTranslationInterface; |
33
|
|
|
use Omatech\Mage\Core\Domains\Translations\Contracts\UpdateTranslationInterface; |
34
|
|
|
use Omatech\Mage\Core\Domains\Translations\Translation; |
35
|
|
|
use Omatech\Mage\Core\Domains\Users\Contracts\AllUserInterface; |
36
|
|
|
use Omatech\Mage\Core\Domains\Users\Contracts\CreateUserInterface; |
37
|
|
|
use Omatech\Mage\Core\Domains\Users\Contracts\DeleteUserInterface; |
38
|
|
|
use Omatech\Mage\Core\Domains\Users\Contracts\ExistsUserInterface; |
39
|
|
|
use Omatech\Mage\Core\Domains\Users\Contracts\FindUserInterface; |
40
|
|
|
use Omatech\Mage\Core\Domains\Users\Contracts\UniqueUserInterface; |
41
|
|
|
use Omatech\Mage\Core\Domains\Users\Contracts\UpdateUserInterface; |
42
|
|
|
use Omatech\Mage\Core\Domains\Users\Contracts\UserInterface; |
43
|
|
|
use Omatech\Mage\Core\Domains\Users\User; |
44
|
|
|
use Omatech\Mage\Core\Repositories\PermissionRepository; |
45
|
|
|
use Omatech\Mage\Core\Repositories\RoleRepository; |
46
|
|
|
use Omatech\Mage\Core\Repositories\TranslationRepository; |
47
|
|
|
use Omatech\Mage\Core\Repositories\UserRepository; |
48
|
|
|
|
49
|
|
|
class MageServiceProvider extends ServiceProvider |
50
|
|
|
{ |
51
|
|
|
/** |
52
|
|
|
* Bootstrap the application services. |
53
|
|
|
*/ |
54
|
45 |
|
public function boot() |
55
|
|
|
{ |
56
|
45 |
|
$this->loadMigrationsFrom(__DIR__.'/database/migrations'); |
57
|
45 |
|
$this->permissionBindings(); |
58
|
45 |
|
$this->roleBindings(); |
59
|
45 |
|
$this->userBindings(); |
60
|
45 |
|
$this->translationBindings(); |
61
|
|
|
|
62
|
|
|
$this->app->bind('mage.permissions', function () { |
63
|
|
|
return new Permission(); |
64
|
45 |
|
}); |
65
|
|
|
|
66
|
|
|
$this->app->bind('mage.roles', function () { |
67
|
|
|
return new Role(); |
68
|
45 |
|
}); |
69
|
|
|
|
70
|
|
|
$this->app->bind('mage.users', function () { |
71
|
|
|
return new User(); |
72
|
45 |
|
}); |
73
|
|
|
|
74
|
|
|
$this->app->bind('mage.translations', function () { |
75
|
|
|
return new Translation(); |
76
|
45 |
|
}); |
77
|
45 |
|
} |
78
|
|
|
|
79
|
45 |
|
private function permissionBindings() |
80
|
|
|
{ |
81
|
45 |
|
$this->app->bind(PermissionInterface::class, Permission::class); |
82
|
45 |
|
$this->app->bind(AllPermissionInterface::class, PermissionRepository::class); |
83
|
45 |
|
$this->app->bind(FindPermissionInterface::class, PermissionRepository::class); |
84
|
45 |
|
$this->app->bind(CreatePermissionInterface::class, PermissionRepository::class); |
85
|
45 |
|
$this->app->bind(DeletePermissionInterface::class, PermissionRepository::class); |
86
|
45 |
|
$this->app->bind(ExistsPermissionInterface::class, PermissionRepository::class); |
87
|
45 |
|
$this->app->bind(UpdatePermissionInterface::class, PermissionRepository::class); |
88
|
45 |
|
$this->app->bind(UniquePermissionInterface::class, PermissionRepository::class); |
89
|
45 |
|
$this->app->bind(AttachedPermissionInterface::class, PermissionRepository::class); |
90
|
45 |
|
} |
91
|
|
|
|
92
|
45 |
|
private function roleBindings() |
93
|
|
|
{ |
94
|
45 |
|
$this->app->bind(RoleInterface::class, Role::class); |
95
|
45 |
|
$this->app->bind(AllRoleInterface::class, RoleRepository::class); |
96
|
45 |
|
$this->app->bind(FindRoleInterface::class, RoleRepository::class); |
97
|
45 |
|
$this->app->bind(CreateRoleInterface::class, RoleRepository::class); |
98
|
45 |
|
$this->app->bind(DeleteRoleInterface::class, RoleRepository::class); |
99
|
45 |
|
$this->app->bind(ExistsRoleInterface::class, RoleRepository::class); |
100
|
45 |
|
$this->app->bind(UpdateRoleInterface::class, RoleRepository::class); |
101
|
45 |
|
$this->app->bind(UniqueRoleInterface::class, RoleRepository::class); |
102
|
45 |
|
$this->app->bind(AttachedRoleInterface::class, RoleRepository::class); |
103
|
45 |
|
} |
104
|
|
|
|
105
|
45 |
|
private function userBindings() |
106
|
|
|
{ |
107
|
45 |
|
$this->app->bind(UserInterface::class, User::class); |
108
|
45 |
|
$this->app->bind(AllUserInterface::class, UserRepository::class); |
109
|
45 |
|
$this->app->bind(FindUserInterface::class, UserRepository::class); |
110
|
45 |
|
$this->app->bind(CreateUserInterface::class, UserRepository::class); |
111
|
45 |
|
$this->app->bind(DeleteUserInterface::class, UserRepository::class); |
112
|
45 |
|
$this->app->bind(ExistsUserInterface::class, UserRepository::class); |
113
|
45 |
|
$this->app->bind(UpdateUserInterface::class, UserRepository::class); |
114
|
45 |
|
$this->app->bind(UniqueUserInterface::class, UserRepository::class); |
115
|
45 |
|
} |
116
|
|
|
|
117
|
45 |
|
private function translationBindings() |
118
|
|
|
{ |
119
|
45 |
|
$this->app->bind(TranslationInterface::class, Translation::class); |
120
|
45 |
|
$this->app->bind(AllTranslationInterface::class, TranslationRepository::class); |
121
|
45 |
|
$this->app->bind(FindTranslationInterface::class, TranslationRepository::class); |
122
|
45 |
|
$this->app->bind(CreateTranslationInterface::class, TranslationRepository::class); |
123
|
45 |
|
$this->app->bind(DeleteTranslationInterface::class, TranslationRepository::class); |
124
|
45 |
|
$this->app->bind(ExistsTranslationInterface::class, TranslationRepository::class); |
125
|
45 |
|
$this->app->bind(UpdateTranslationInterface::class, TranslationRepository::class); |
126
|
45 |
|
$this->app->bind(UniqueTranslationInterface::class, TranslationRepository::class); |
127
|
45 |
|
} |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* Register the application services. |
131
|
|
|
*/ |
132
|
45 |
|
public function register() |
133
|
|
|
{ |
134
|
45 |
|
$this->mergeConfigFrom( |
135
|
45 |
|
__DIR__.'/../config/config.php', |
136
|
45 |
|
'mage' |
137
|
|
|
); |
138
|
|
|
|
139
|
45 |
|
$this->mergeConfigFrom( |
140
|
45 |
|
__DIR__.'/../config/permission.php', |
141
|
45 |
|
'permission' |
142
|
|
|
); |
143
|
|
|
|
144
|
45 |
|
$this->mergeConfigFrom( |
145
|
45 |
|
__DIR__.'/../config/auth.providers.php', |
146
|
45 |
|
'auth.providers' |
147
|
|
|
); |
148
|
|
|
|
149
|
45 |
|
$this->mergeConfigFrom( |
150
|
45 |
|
__DIR__.'/../config/auth.guards.php', |
151
|
45 |
|
'auth.guards' |
152
|
|
|
); |
153
|
|
|
|
154
|
45 |
|
$this->mergeConfigFrom( |
155
|
45 |
|
__DIR__.'/../config/translation-loader.php', |
156
|
45 |
|
'translation-loader' |
157
|
|
|
); |
158
|
45 |
|
} |
159
|
|
|
} |
160
|
|
|
|