1
|
|
|
<?php |
|
|
|
|
2
|
|
|
|
3
|
|
|
namespace Scool\EnrollmentMobile\Providers; |
4
|
|
|
|
5
|
|
|
use Acacha\Names\Providers\NamesServiceProvider; |
6
|
|
|
<<<<<<< HEAD:src/Providers/EnrollmentMobileServiceProvider.php |
|
|
|
|
7
|
|
|
use Acacha\Stateful\Providers\StatefulServiceProvider; |
8
|
|
|
======= |
9
|
|
|
>>>>>>> 92a55437464d45d8f28bae26a5a84fc695a03898:src/Providers/PaymentsServiceProvider.php |
10
|
|
|
use Illuminate\Support\ServiceProvider; |
11
|
|
|
use Scool\EnrollmentMobile\ScoolEnrollmentMobile; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Class EnrollmentServiceProvider |
15
|
|
|
* @package Scool\Enrollment\Providers |
16
|
|
|
*/ |
17
|
|
|
class PaymentsServiceProvider extends ServiceProvider |
18
|
|
|
{ |
19
|
|
|
public function register() |
20
|
|
|
{ |
21
|
|
|
if (!defined('SCOOL_ENROLLMENT_MOBILE_PATH')) { |
22
|
|
|
define('SCOOL_ENROLLMENT_MOBILE_PATH', realpath(__DIR__.'/../../')); |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
<<<<<<< HEAD:src/Providers/EnrollmentMobileServiceProvider.php |
26
|
|
|
$this->registerNameServiceProvider(); |
27
|
|
|
|
28
|
|
|
$this->registerStatefulEloquentServiceProvider(); |
29
|
|
|
======= |
30
|
|
|
$this->app->register(NamesServiceProvider::class); |
31
|
|
|
>>>>>>> 92a55437464d45d8f28bae26a5a84fc695a03898:src/Providers/PaymentsServiceProvider.php |
32
|
|
|
|
33
|
|
|
$this->app->bind(\Scool\EnrollmentMobile\Repositories\EnrollmentRepository::class, \Scool\EnrollmentMobile\Repositories\EnrollmentRepositoryEloquent::class); |
34
|
|
|
|
35
|
|
|
// $this->app->bind(StatsRepositoryInterface::class,function() { |
|
|
|
|
36
|
|
|
// return new CacheableStatsRepository(new StatsRepository()); |
37
|
|
|
// }); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
public function boot() |
41
|
|
|
{ |
42
|
|
|
$this->defineRoutes(); |
43
|
|
|
$this->loadMigrations(); |
44
|
|
|
$this->publishFactories(); |
45
|
|
|
$this->publishConfig(); |
46
|
|
|
$this->publishTests(); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
protected function defineRoutes() |
50
|
|
|
{ |
51
|
|
|
if (!$this->app->routesAreCached()) { |
52
|
|
|
$router = app('router'); |
53
|
|
|
$router->group(['namespace' => 'Scool\EnrollmentMobile\Http\Controllers'], function () { |
54
|
|
|
require __DIR__.'/../Http/routes.php'; |
55
|
|
|
}); |
56
|
|
|
} |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
|
60
|
|
|
public function loadMigrations() |
61
|
|
|
{ |
62
|
|
|
$this->loadMigrationsFrom(SCOOL_ENROLLMENT_MOBILE_PATH . '/database/migrations'); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
public function publishFactories() |
66
|
|
|
{ |
67
|
|
|
$this->publishes( |
68
|
|
|
ScoolEnrollmentMobile::factories(), "scool_enrollment_mobile" |
69
|
|
|
); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
|
73
|
|
|
private function publishConfig() |
74
|
|
|
{ |
75
|
|
|
$this->publishes( |
76
|
|
|
ScoolEnrollmentMobile::configs(), "scool_enrollment_mobile" |
77
|
|
|
); |
78
|
|
|
$this->mergeConfigFrom( |
79
|
|
|
SCOOL_ENROLLMENT_MOBILE_PATH . '/config/payment.php', 'scool_enrollment_mobile' |
80
|
|
|
); |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
public function publishTests() |
84
|
|
|
{ |
85
|
|
|
$this->publishes( |
86
|
|
|
[ |
87
|
|
|
SCOOL_ENROLLMENT_MOBILE_PATH .'/tests/EnrollmentMobileTest.php' => 'tests/EnrollmentMobileTest.php' |
88
|
|
|
], "scool_enrollment_mobile" |
89
|
|
|
); |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/* |
93
|
|
|
* Register acacha/names Service Provider. |
94
|
|
|
* |
95
|
|
|
*/ |
96
|
|
|
protected function registerNameServiceProvider() |
97
|
|
|
{ |
98
|
|
|
$this->app->register(NamesServiceProvider::class); |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/* |
102
|
|
|
* Register acacha/stateful-eloquent Service Provider. |
103
|
|
|
* |
104
|
|
|
*/ |
105
|
|
|
protected function registerStatefulEloquentServiceProvider() |
106
|
|
|
{ |
107
|
|
|
$this->app->register(StatefulServiceProvider::class); |
108
|
|
|
} |
109
|
|
|
} |
110
|
|
|
|
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.