|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace App\Ship\Engine\Providers; |
|
4
|
|
|
|
|
5
|
|
|
use App\Ship\Engine\Loaders\AutoLoaderTrait; |
|
6
|
|
|
use App\Ship\Engine\Loaders\FactoriesLoaderTrait; |
|
7
|
|
|
use App\Ship\Engine\Traits\FractalTrait; |
|
8
|
|
|
use App\Ship\Features\Validations\ValidationTrait; |
|
9
|
|
|
use App\Ship\Engine\Butlers\ContainersButler; |
|
10
|
|
|
use App\Ship\Engine\Butlers\ShipButler; |
|
11
|
|
|
use App\Ship\Parents\Providers\MainProvider; |
|
12
|
|
|
use App\Ship\Parents\Providers\RoutesProvider; |
|
13
|
|
|
use Barryvdh\Cors\ServiceProvider as CorsServiceProvider; |
|
14
|
|
|
use Dingo\Api\Provider\LaravelServiceProvider as DingoApiServiceProvider; |
|
15
|
|
|
use Illuminate\Support\Facades\Schema; |
|
16
|
|
|
use Prettus\Repository\Providers\RepositoryServiceProvider; |
|
17
|
|
|
use Vinkla\Hashids\Facades\Hashids; |
|
18
|
|
|
use Vinkla\Hashids\HashidsServiceProvider; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* The App Service Provider where all Service Providers gets registered |
|
22
|
|
|
* this is the only Service Provider that gets injected in the Config/app.php. |
|
23
|
|
|
* |
|
24
|
|
|
* A.K.A app/Providers/AppServiceProvider.php |
|
25
|
|
|
* |
|
26
|
|
|
* Class MainServiceProvider |
|
27
|
|
|
* |
|
28
|
|
|
* @author Mahmoud Zalt <[email protected]> |
|
29
|
|
|
*/ |
|
30
|
|
|
class PortoServiceProvider extends MainProvider |
|
31
|
|
|
{ |
|
32
|
|
|
|
|
33
|
|
|
use FractalTrait; |
|
34
|
|
|
use FactoriesLoaderTrait; |
|
35
|
|
|
use AutoLoaderTrait; |
|
36
|
|
|
use ValidationTrait; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* Register any Service Providers on the Ship layer (including third party packages). |
|
40
|
|
|
* |
|
41
|
|
|
* @var array |
|
42
|
|
|
*/ |
|
43
|
|
|
public $serviceProviders = [ |
|
44
|
|
|
DingoApiServiceProvider::class, |
|
45
|
|
|
CorsServiceProvider::class, |
|
46
|
|
|
HashidsServiceProvider::class, |
|
47
|
|
|
RoutesProvider::class, |
|
48
|
|
|
RepositoryServiceProvider::class |
|
49
|
|
|
]; |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* Register any Alias on the Ship layer (including third party packages). |
|
53
|
|
|
* |
|
54
|
|
|
* @var array |
|
55
|
|
|
*/ |
|
56
|
|
|
protected $aliases = [ |
|
57
|
|
|
'Hashids' => Hashids::class, |
|
58
|
|
|
]; |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* Bootstrap any application services. |
|
62
|
|
|
* |
|
63
|
|
|
* @return void |
|
64
|
|
|
*/ |
|
65
|
|
|
public function boot() |
|
66
|
|
|
{ |
|
67
|
|
|
// Autoload most of the Containers and Ship Components |
|
68
|
|
|
$this->runLoadersBoot(); |
|
69
|
|
|
|
|
70
|
|
|
// load all service providers defined in this class |
|
71
|
|
|
parent::boot(); |
|
72
|
|
|
|
|
73
|
|
|
// Change the default Fractal Serializer |
|
74
|
|
|
$this->overrideDefaultFractalSerializer(); |
|
75
|
|
|
|
|
76
|
|
|
// Solves the "specified key was too long" error, introduced in L5.4 |
|
77
|
|
|
Schema::defaultStringLength(191); |
|
78
|
|
|
|
|
79
|
|
|
// Registering custom validation rules |
|
80
|
|
|
$this->extendValidationRules(); |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* Register any application services. |
|
85
|
|
|
* |
|
86
|
|
|
* @return void |
|
87
|
|
|
*/ |
|
88
|
|
|
public function register() |
|
89
|
|
|
{ |
|
90
|
|
|
parent::register(); |
|
91
|
|
|
|
|
92
|
|
|
// Register Engine Facade Classes |
|
93
|
|
|
$this->app->alias(ShipButler::class, 'ShipButler'); |
|
94
|
|
|
$this->app->alias(ContainersButler::class, 'ContainersButler'); |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
} |
|
98
|
|
|
|