1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Scool\EnrollmentMobile\Providers; |
4
|
|
|
|
5
|
|
|
use Acacha\Names\Providers\NamesServiceProvider; |
6
|
|
|
use Acacha\Stateful\Providers\StatefulServiceProvider; |
7
|
|
|
use Illuminate\Support\ServiceProvider; |
8
|
|
|
use Scool\EnrollmentMobile\ScoolEnrollmentMobile; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Class EnrollmentServiceProvider |
12
|
|
|
* @package Scool\Enrollment\Providers |
13
|
|
|
*/ |
14
|
|
|
class PaymentsServiceProvider extends ServiceProvider |
15
|
|
|
{ |
16
|
|
|
public function register() |
17
|
|
|
{ |
18
|
|
|
if (!defined('SCOOL_ENROLLMENT_MOBILE_PATH')) { |
19
|
|
|
define('SCOOL_ENROLLMENT_MOBILE_PATH', realpath(__DIR__.'/../../')); |
20
|
|
|
} |
21
|
|
|
$this->registerNameServiceProvider(); |
22
|
|
|
|
23
|
|
|
$this->registerStatefulEloquentServiceProvider(); |
24
|
|
|
|
25
|
|
|
$this->app->bind(\Scool\EnrollmentMobile\Repositories\EnrollmentRepository::class, \Scool\EnrollmentMobile\Repositories\EnrollmentRepositoryEloquent::class); |
26
|
|
|
$this->app->bind(\Scool\EnrollmentMobile\Repositories\ClassroomRepository::class, \Scool\EnrollmentMobile\Repositories\ClassroomRepositoryEloquent::class); |
27
|
|
|
$this->app->bind(\Scool\EnrollmentMobile\Repositories\CourseRepository::class, \Scool\EnrollmentMobile\Repositories\CourseRepositoryEloquent::class); |
28
|
|
|
$this->app->bind(\Scool\EnrollmentMobile\Repositories\EnrollmentStudySubmoduleRepository::class, \Scool\EnrollmentMobile\Repositories\EnrollmentStudySubmoduleRepositoryEloquent::class); |
29
|
|
|
$this->app->bind(\Scool\EnrollmentMobile\Repositories\CycleRepository::class, \Scool\EnrollmentMobile\Repositories\CycleRepositoryEloquent::class); |
30
|
|
|
$this->app->bind(\Scool\EnrollmentMobile\Repositories\FamilyRepository::class, \Scool\EnrollmentMobile\Repositories\FamilyRepositoryEloquent::class); |
31
|
|
|
$this->app->bind(\Scool\EnrollmentMobile\Repositories\ModuleRepository::class, \Scool\EnrollmentMobile\Repositories\ModuleRepositoryEloquent::class); |
32
|
|
|
$this->app->bind(\Scool\EnrollmentMobile\Repositories\SubmoduleRepository::class, \Scool\EnrollmentMobile\Repositories\SubmoduleRepositoryEloquent::class); |
33
|
|
|
$this->app->bind(\Scool\EnrollmentMobile\Repositories\SubmoduleTypeRepository::class, \Scool\EnrollmentMobile\Repositories\SubmoduleTypeRepositoryEloquent::class); |
34
|
|
|
$this->app->bind(\Scool\EnrollmentMobile\Repositories\PersonRepository::class, \Scool\EnrollmentMobile\Repositories\PersonRepositoryEloquent::class); |
35
|
|
|
//:end-bindings: |
|
|
|
|
36
|
|
|
// $this->app->bind(StatsRepositoryInterface::class,function() { |
37
|
|
|
// return new CacheableStatsRepository(new StatsRepository()); |
38
|
|
|
// }); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
public function boot() |
42
|
|
|
{ |
43
|
|
|
$this->defineRoutes(); |
44
|
|
|
$this->loadMigrations(); |
45
|
|
|
$this->publishFactories(); |
46
|
|
|
$this->publishConfig(); |
47
|
|
|
$this->publishTests(); |
48
|
|
|
$this->publishVueComponents(); |
49
|
|
|
$this->loadViews(); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
protected function defineRoutes() |
53
|
|
|
{ |
54
|
|
|
if (!$this->app->routesAreCached()) { |
55
|
|
|
$router = app('router'); |
56
|
|
|
$router->group(['namespace' => 'Scool\EnrollmentMobile\Http\Controllers'], function () { |
57
|
|
|
require __DIR__.'/../Http/routes.php'; |
58
|
|
|
}); |
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
|
63
|
|
|
public function loadMigrations() |
64
|
|
|
{ |
65
|
|
|
$this->loadMigrationsFrom(SCOOL_ENROLLMENT_MOBILE_PATH . '/database/migrations'); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
private function loadViews() |
69
|
|
|
{ |
70
|
|
|
$this->loadViewsFrom(SCOOL_ENROLLMENT_MOBILE_PATH . '/resources/views', 'enrollment_mobile'); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
|
74
|
|
|
public function publishFactories() |
75
|
|
|
{ |
76
|
|
|
$this->publishes( |
77
|
|
|
ScoolEnrollmentMobile::factories(), "enrollment_mobile" |
78
|
|
|
); |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
public function publishVueComponents() |
82
|
|
|
{ |
83
|
|
|
$this->publishes( |
84
|
|
|
ScoolEnrollmentMobile::vue(), "enrollment_mobile" |
85
|
|
|
); |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
private function publishConfig() |
89
|
|
|
{ |
90
|
|
|
$this->publishes( |
91
|
|
|
ScoolEnrollmentMobile::configs(), "enrollment_mobile" |
92
|
|
|
); |
93
|
|
|
$this->mergeConfigFrom( |
94
|
|
|
SCOOL_ENROLLMENT_MOBILE_PATH . '/config/payment.php', 'enrollment_mobile' |
95
|
|
|
); |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
public function publishTests() |
99
|
|
|
{ |
100
|
|
|
$this->publishes( |
101
|
|
|
[ |
102
|
|
|
SCOOL_ENROLLMENT_MOBILE_PATH .'/tests/EnrollmentMobileTest.php' => 'tests/EnrollmentMobileTest.php' |
103
|
|
|
], "enrollment_mobile" |
104
|
|
|
); |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/* |
108
|
|
|
* Register acacha/names Service Provider. |
109
|
|
|
* |
110
|
|
|
*/ |
111
|
|
|
protected function registerNameServiceProvider() |
112
|
|
|
{ |
113
|
|
|
$this->app->register(NamesServiceProvider::class); |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/* |
117
|
|
|
* Register acacha/stateful-eloquent Service Provider. |
118
|
|
|
* |
119
|
|
|
*/ |
120
|
|
|
protected function registerStatefulEloquentServiceProvider() |
121
|
|
|
{ |
122
|
|
|
$this->app->register(StatefulServiceProvider::class); |
123
|
|
|
} |
124
|
|
|
} |
125
|
|
|
|
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.