1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Scool\EnrollmentMobile\Providers; |
4
|
|
|
|
5
|
|
|
use Illuminate\Support\ServiceProvider; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Class EnrollmentServiceProvider |
9
|
|
|
* @package Scool\Enrollment\Providers |
10
|
|
|
*/ |
11
|
|
|
class EnrollmentMobileServiceProvider extends ServiceProvider |
12
|
|
|
{ |
13
|
|
|
public function register() |
14
|
|
|
{ |
15
|
|
|
if (!defined('SCOOL_ENROLLMENT_MOBILE_PATH')) { |
16
|
|
|
define('SCOOL_ENROLLMENT_MOBILE_PATH', realpath(__DIR__.'/../../')); |
17
|
|
|
} |
18
|
|
|
|
19
|
|
|
//$this->app->register(NamesServiceProvider::class); |
|
|
|
|
20
|
|
|
|
21
|
|
|
$this->app->bind(\Scool\EnrollmentMobile\Repositories\EnrollmentRepository::class, \Scool\EnrollmentMobile\Repositories\EnrollmentRepositoryEloquent::class); |
22
|
|
|
|
23
|
|
|
// $this->app->bind(StatsRepositoryInterface::class,function() { |
|
|
|
|
24
|
|
|
// return new CacheableStatsRepository(new StatsRepository()); |
25
|
|
|
// }); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
public function boot() |
29
|
|
|
{ |
30
|
|
|
$this->defineRoutes(); |
31
|
|
|
$this->loadMigrations(); |
32
|
|
|
$this->publishFactories(); |
33
|
|
|
$this->publishConfig(); |
34
|
|
|
$this->publishTests(); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
protected function defineRoutes() |
38
|
|
|
{ |
39
|
|
|
if (!$this->app->routesAreCached()) { |
40
|
|
|
$router = app('router'); |
41
|
|
|
$router->group(['namespace' => 'Scool\EnrollmentMobile\Http\Controllers'], function () { |
42
|
|
|
require __DIR__.'/../Http/routes.php'; |
43
|
|
|
}); |
44
|
|
|
} |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
|
48
|
|
|
public function loadMigrations() |
49
|
|
|
{ |
50
|
|
|
$this->loadMigrationsFrom(__DIR__.'/../../database/migrations'); |
51
|
|
|
//$this->loadMigrationsFrom(SCOOL_ENROLLMENT_MOBILE_PATH.'/database/migrations'); |
|
|
|
|
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
public function publishFactories() |
55
|
|
|
{ |
56
|
|
|
$this->publishes( |
57
|
|
|
[ |
58
|
|
|
SCOOL_ENROLLMENT_MOBILE_PATH . '/database/factories/EnrollmentMobileFactory.php' => |
59
|
|
|
database_path().'/factories/EnrollmentMobileFactory.php'], |
60
|
|
|
"scool_enrollment_mobile" |
61
|
|
|
); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function publishTests() |
65
|
|
|
{ |
66
|
|
|
$this->publishes( |
67
|
|
|
[ |
68
|
|
|
SCOOL_ENROLLMENT_MOBILE_PATH . |
69
|
|
|
'/tests/EnrollmentMobileTest.php' => 'tests/EnrollmentMobileTest.php' |
70
|
|
|
], "scool_enrollment_mobile" |
71
|
|
|
); |
72
|
|
|
} |
73
|
|
|
private function publishConfig() |
74
|
|
|
{ |
75
|
|
|
$this->publishes( |
76
|
|
|
[ SCOOL_ENROLLMENT_MOBILE_PATH . '/config/enrollment.php' => |
77
|
|
|
database_path().'/factories/EnrollmentMobileFactory.php'], "scool_enrollment_mobile" |
78
|
|
|
); |
79
|
|
|
$this->mergeConfigFrom( |
80
|
|
|
[ |
|
|
|
|
81
|
|
|
SCOOL_ENROLLMENT_MOBILE_PATH . '/config/enrollment_mobile.php' |
82
|
|
|
=> config_path() . 'enrollment_mobile' |
83
|
|
|
],"scool_enrollment_mobile" |
84
|
|
|
); |
85
|
|
|
} |
86
|
|
|
} |
87
|
|
|
|
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.