1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Providers; |
4
|
|
|
|
5
|
|
|
use Illuminate\Database\Eloquent\Model; |
6
|
|
|
use Illuminate\Support\ServiceProvider; |
7
|
|
|
use Illuminate\Support\Facades\Blade; |
8
|
|
|
use Illuminate\Support\Facades\Log; |
9
|
|
|
use Illuminate\Support\Facades\DB; |
10
|
|
|
use Mcamara\LaravelLocalization\LaravelLocalization; |
11
|
|
|
use Siak\Tontine\Service\BalanceCalculator; |
12
|
|
|
use Siak\Tontine\Service\LocaleService; |
13
|
|
|
use Siak\Tontine\Service\TenantService; |
14
|
|
|
use Siak\Tontine\Service\Meeting\Cash\DisbursementService; |
15
|
|
|
use Siak\Tontine\Service\Meeting\Charge\BillService; |
16
|
|
|
use Siak\Tontine\Service\Meeting\Charge\FixedFeeService; |
17
|
|
|
use Siak\Tontine\Service\Meeting\Charge\LibreFeeService; |
18
|
|
|
use Siak\Tontine\Service\Meeting\Charge\SettlementService; |
19
|
|
|
use Siak\Tontine\Service\Meeting\Charge\SettlementTargetService; |
20
|
|
|
use Siak\Tontine\Service\Meeting\Credit\DebtCalculator; |
21
|
|
|
use Siak\Tontine\Service\Meeting\Credit\LoanService; |
22
|
|
|
use Siak\Tontine\Service\Meeting\Credit\PartialRefundService; |
23
|
|
|
use Siak\Tontine\Service\Meeting\Credit\RefundService; |
24
|
|
|
use Siak\Tontine\Service\Meeting\PaymentServiceInterface; |
25
|
|
|
use Siak\Tontine\Service\Meeting\PaymentService; |
26
|
|
|
use Siak\Tontine\Service\Meeting\Pool\AuctionService; |
27
|
|
|
use Siak\Tontine\Service\Meeting\Pool\DepositService; |
28
|
|
|
use Siak\Tontine\Service\Meeting\Pool\PoolService as MeetingPoolService; |
29
|
|
|
use Siak\Tontine\Service\Meeting\Pool\RemitmentService; |
30
|
|
|
use Siak\Tontine\Service\Meeting\PresenceService; |
31
|
|
|
use Siak\Tontine\Service\Meeting\Saving\ClosingService; |
32
|
|
|
use Siak\Tontine\Service\Meeting\Saving\ProfitService; |
33
|
|
|
use Siak\Tontine\Service\Meeting\Saving\SavingService; |
34
|
|
|
use Siak\Tontine\Service\Meeting\SessionService as MeetingSessionService; |
35
|
|
|
use Siak\Tontine\Service\Meeting\SummaryService as MeetingSummaryService; |
36
|
|
|
use Siak\Tontine\Service\Planning\PoolService as TontinePoolService; |
37
|
|
|
use Siak\Tontine\Service\Planning\RoundService; |
38
|
|
|
use Siak\Tontine\Service\Planning\SessionService as PlanningSessionService; |
39
|
|
|
use Siak\Tontine\Service\Planning\SubscriptionService; |
40
|
|
|
use Siak\Tontine\Service\Planning\SummaryService as PlanningSummaryService; |
41
|
|
|
use Siak\Tontine\Service\Report\MemberService as MemberReportService; |
42
|
|
|
use Siak\Tontine\Service\Report\Pdf\PdfPrinterService; |
43
|
|
|
use Siak\Tontine\Service\Report\ReportService; |
44
|
|
|
use Siak\Tontine\Service\Report\RoundService as RoundReportService; |
45
|
|
|
use Siak\Tontine\Service\Report\SessionService as SessionReportService; |
46
|
|
|
use Siak\Tontine\Service\Tontine\CategoryService; |
47
|
|
|
use Siak\Tontine\Service\Tontine\ChargeService; |
48
|
|
|
use Siak\Tontine\Service\Tontine\FundService; |
49
|
|
|
use Siak\Tontine\Service\Tontine\UserService; |
50
|
|
|
use Siak\Tontine\Service\Tontine\MemberService; |
51
|
|
|
use Siak\Tontine\Service\Tontine\TontineService; |
52
|
|
|
use Siak\Tontine\Validation\Meeting\ClosingValidator; |
53
|
|
|
use Siak\Tontine\Validation\Meeting\DisbursementValidator; |
54
|
|
|
use Siak\Tontine\Validation\Meeting\DebtValidator; |
55
|
|
|
use Siak\Tontine\Validation\Meeting\LoanValidator; |
56
|
|
|
use Siak\Tontine\Validation\Meeting\RemitmentValidator; |
57
|
|
|
use Siak\Tontine\Validation\Meeting\SavingValidator; |
58
|
|
|
use Siak\Tontine\Validation\Meeting\TargetValidator; |
59
|
|
|
use Siak\Tontine\Validation\Planning\PoolValidator; |
60
|
|
|
use Siak\Tontine\Validation\Planning\PoolRoundValidator; |
61
|
|
|
use Siak\Tontine\Validation\Planning\RoundValidator; |
62
|
|
|
use Siak\Tontine\Validation\Planning\SessionValidator; |
63
|
|
|
use Siak\Tontine\Validation\Tontine\ChargeValidator; |
64
|
|
|
use Siak\Tontine\Validation\Tontine\FundValidator; |
65
|
|
|
use Siak\Tontine\Validation\Tontine\GuestInviteValidator; |
66
|
|
|
use Siak\Tontine\Validation\Tontine\HostAccessValidator; |
67
|
|
|
use Siak\Tontine\Validation\Tontine\MemberValidator; |
68
|
|
|
use Siak\Tontine\Validation\Tontine\OptionsValidator; |
69
|
|
|
use Siak\Tontine\Validation\Tontine\TontineValidator; |
70
|
|
|
use Sqids\Sqids; |
71
|
|
|
use Sqids\SqidsInterface; |
72
|
|
|
|
73
|
|
|
use function base_path; |
74
|
|
|
use function config; |
75
|
|
|
|
76
|
|
|
class SiakServiceProvider extends ServiceProvider |
77
|
|
|
{ |
78
|
|
|
/** |
79
|
|
|
* Bootstrap any application services. |
80
|
|
|
* |
81
|
|
|
* @return void |
82
|
|
|
*/ |
83
|
|
|
public function boot() |
84
|
|
|
{ |
85
|
|
|
// Log database queries |
86
|
|
|
// DB::listen(function($query) { |
87
|
|
|
// Log::info($query->sql, $query->bindings, $query->time); |
88
|
|
|
// }); |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* Register any application services |
93
|
|
|
* |
94
|
|
|
* @return void |
95
|
|
|
*/ |
96
|
|
|
public function register() |
97
|
|
|
{ |
98
|
|
|
$this->app->singleton(LocaleService::class, function($app) { |
99
|
|
|
$vendorDir = base_path('vendor'); |
100
|
|
|
// Read country list from the umpirsky/country-list package data. |
101
|
|
|
$countriesDataDir = $vendorDir . '/umpirsky/country-list/data'; |
102
|
|
|
// Read currency list from the umpirsky/currency-list package data. |
103
|
|
|
$currenciesDataDir = $vendorDir . '/umpirsky/currency-list/data'; |
104
|
|
|
$localization = $app->make(LaravelLocalization::class); |
105
|
|
|
return new LocaleService($localization, $countriesDataDir, $currenciesDataDir); |
106
|
|
|
}); |
107
|
|
|
$this->app->singleton(SqidsInterface::class, function() { |
108
|
|
|
return new Sqids(minLength: 8); |
109
|
|
|
}); |
110
|
|
|
|
111
|
|
|
$this->app->singleton(FundService::class, FundService::class); |
112
|
|
|
$this->app->singleton(ChargeService::class, ChargeService::class); |
113
|
|
|
$this->app->singleton(CategoryService::class, CategoryService::class); |
114
|
|
|
$this->app->singleton(FixedFeeService::class, FixedFeeService::class); |
115
|
|
|
$this->app->singleton(LibreFeeService::class, LibreFeeService::class); |
116
|
|
|
$this->app->singleton(BillService::class, BillService::class); |
117
|
|
|
$this->app->singleton(SettlementService::class, SettlementService::class); |
118
|
|
|
$this->app->singleton(SettlementTargetService::class, SettlementTargetService::class); |
119
|
|
|
|
120
|
|
|
$this->app->singleton(ClosingService::class, ClosingService::class); |
121
|
|
|
$this->app->singleton(SavingService::class, SavingService::class); |
122
|
|
|
$this->app->singleton(DebtCalculator::class, DebtCalculator::class); |
123
|
|
|
$this->app->singleton(LoanService::class, LoanService::class); |
124
|
|
|
$this->app->singleton(AuctionService::class, AuctionService::class); |
125
|
|
|
$this->app->singleton(DepositService::class, DepositService::class); |
126
|
|
|
$this->app->singleton(BalanceCalculator::class, BalanceCalculator::class); |
127
|
|
|
$this->app->singleton(DisbursementService::class, DisbursementService::class); |
128
|
|
|
$this->app->singleton(MeetingPoolService::class, MeetingPoolService::class); |
129
|
|
|
$this->app->singleton(RefundService::class, RefundService::class); |
130
|
|
|
$this->app->singleton(PartialRefundService::class, PartialRefundService::class); |
131
|
|
|
$this->app->singleton(ProfitService::class, ProfitService::class); |
132
|
|
|
$this->app->singleton(RemitmentService::class, RemitmentService::class); |
133
|
|
|
$this->app->singleton(MeetingSummaryService::class, MeetingSummaryService::class); |
134
|
|
|
$this->app->singleton(MeetingSessionService::class, MeetingSessionService::class); |
135
|
|
|
$this->app->singleton(PresenceService::class, PresenceService::class); |
136
|
|
|
$this->app->singleton(MemberReportService::class, MemberReportService::class); |
137
|
|
|
$this->app->singleton(RoundReportService::class, RoundReportService::class); |
138
|
|
|
$this->app->singleton(SessionReportService::class, SessionReportService::class); |
139
|
|
|
$this->app->singleton(ReportService::class, ReportService::class); |
140
|
|
|
$this->app->singleton(PdfPrinterService::class, PdfPrinterService::class); |
141
|
|
|
$this->app->when(PdfPrinterService::class) |
142
|
|
|
->needs('$config') |
143
|
|
|
->give(config('chrome.page')); |
144
|
|
|
|
145
|
|
|
$this->app->singleton(RoundService::class, RoundService::class); |
146
|
|
|
$this->app->singleton(PlanningSessionService::class, PlanningSessionService::class); |
147
|
|
|
$this->app->singleton(SubscriptionService::class, SubscriptionService::class); |
148
|
|
|
$this->app->singleton(PlanningSummaryService::class, PlanningSummaryService::class); |
149
|
|
|
|
150
|
|
|
$this->app->singleton(TenantService::class, TenantService::class); |
151
|
|
|
$this->app->singleton(TontinePoolService::class, TontinePoolService::class); |
152
|
|
|
$this->app->singleton(UserService::class, UserService::class); |
153
|
|
|
$this->app->singleton(MemberService::class, MemberService::class); |
154
|
|
|
$this->app->singleton(TontineService::class, TontineService::class); |
155
|
|
|
|
156
|
|
|
$this->app->singleton(PaymentService::class, PaymentService::class); |
157
|
|
|
$this->app->singleton(PaymentServiceInterface::class, function() { |
158
|
|
|
return new class implements PaymentServiceInterface { |
159
|
|
|
// By default, all the payment items are editable. |
160
|
|
|
public function isEditable(Model $_): bool |
161
|
|
|
{ |
162
|
|
|
return true; |
163
|
|
|
} |
164
|
|
|
}; |
165
|
|
|
}); |
166
|
|
|
|
167
|
|
|
$this->app->singleton(ChargeValidator::class, ChargeValidator::class); |
168
|
|
|
$this->app->singleton(DebtValidator::class, DebtValidator::class); |
169
|
|
|
$this->app->singleton(FundValidator::class, FundValidator::class); |
170
|
|
|
$this->app->singleton(SavingValidator::class, SavingValidator::class); |
171
|
|
|
$this->app->singleton(ClosingValidator::class, ClosingValidator::class); |
172
|
|
|
$this->app->singleton(DisbursementValidator::class, DisbursementValidator::class); |
173
|
|
|
$this->app->singleton(LoanValidator::class, LoanValidator::class); |
174
|
|
|
$this->app->singleton(MemberValidator::class, MemberValidator::class); |
175
|
|
|
$this->app->singleton(RoundValidator::class, RoundValidator::class); |
176
|
|
|
$this->app->singleton(PoolValidator::class, PoolValidator::class); |
177
|
|
|
$this->app->singleton(PoolRoundValidator::class, PoolRoundValidator::class); |
178
|
|
|
$this->app->singleton(RemitmentValidator::class, RemitmentValidator::class); |
179
|
|
|
$this->app->singleton(SessionValidator::class, SessionValidator::class); |
180
|
|
|
$this->app->singleton(OptionsValidator::class, OptionsValidator::class); |
181
|
|
|
$this->app->singleton(TontineValidator::class, TontineValidator::class); |
182
|
|
|
$this->app->singleton(TargetValidator::class, TargetValidator::class); |
183
|
|
|
$this->app->singleton(HostAccessValidator::class, HostAccessValidator::class); |
184
|
|
|
$this->app->singleton(GuestInviteValidator::class, GuestInviteValidator::class); |
185
|
|
|
} |
186
|
|
|
} |
187
|
|
|
|