|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace AfzalSabbir\SSLaraCommerz; |
|
4
|
|
|
|
|
5
|
|
|
use Illuminate\Support\ServiceProvider; |
|
6
|
|
|
use Illuminate\Support\Facades\Route; |
|
7
|
|
|
|
|
8
|
|
|
class SSLaraCommerzServiceProvider extends ServiceProvider |
|
9
|
|
|
{ |
|
10
|
|
|
/** |
|
11
|
|
|
* Bootstrap any application services. |
|
12
|
|
|
* |
|
13
|
|
|
* @return void |
|
14
|
|
|
*/ |
|
15
|
|
|
public function boot() |
|
16
|
|
|
{ |
|
17
|
|
|
$this->mergeConfigFrom(__DIR__ . '/../config/sslcommerz.php', 'sslcommerz'); |
|
18
|
|
|
|
|
19
|
|
|
$this->publishConfig(); |
|
20
|
|
|
$this->publishViews(); |
|
21
|
|
|
$this->publishMigrations(); |
|
22
|
|
|
//$this->publishModel(); |
|
23
|
|
|
$this->publishAssets(); |
|
24
|
|
|
$this->publishRoutesAndController(); |
|
25
|
|
|
|
|
26
|
|
|
$this->loadViewsFrom(__DIR__ . '/resources/views', 'sslaracommerz'); |
|
27
|
|
|
$this->loadMigrationsFrom(__DIR__ . '/../database/migrations'); |
|
28
|
|
|
$this->registerRoutes(); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* Register the package routes. |
|
33
|
|
|
* |
|
34
|
|
|
* @return void |
|
35
|
|
|
*/ |
|
36
|
|
|
private function registerRoutes() |
|
37
|
|
|
{ |
|
38
|
|
|
Route::group($this->routeConfiguration(), function () { |
|
39
|
|
|
$this->loadRoutesFrom(__DIR__ . '/Http/routes.php'); |
|
40
|
|
|
}); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* Get route group configuration array. |
|
45
|
|
|
* |
|
46
|
|
|
* @return array |
|
47
|
|
|
*/ |
|
48
|
|
|
private function routeConfiguration() |
|
49
|
|
|
{ |
|
50
|
|
|
return [ |
|
51
|
|
|
'namespace' => "AfzalSabbir\SSLaraCommerz\Http\Controllers", |
|
52
|
|
|
// 'middleware' => 'api', |
|
53
|
|
|
// 'prefix' => 'api' |
|
54
|
|
|
]; |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* Register any application services. |
|
59
|
|
|
* |
|
60
|
|
|
* @return void |
|
61
|
|
|
*/ |
|
62
|
|
|
public function register() |
|
63
|
|
|
{ |
|
64
|
|
|
// Register facade |
|
65
|
|
|
$this->app->singleton('sslaracommerz', function () { |
|
66
|
|
|
return new SSLaraCommerz; |
|
67
|
|
|
}); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* Publish Config |
|
72
|
|
|
* |
|
73
|
|
|
* @return void |
|
74
|
|
|
*/ |
|
75
|
|
|
public function publishConfig(): void |
|
76
|
|
|
{ |
|
77
|
|
|
if ($this->app->runningInConsole()) { |
|
78
|
|
|
$this->publishes([ |
|
79
|
|
|
__DIR__ . '/../config/sslcommerz.php' => config_path('sslcommerz.php'), |
|
80
|
|
|
], 'config'); |
|
81
|
|
|
} |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* Publish Views |
|
86
|
|
|
* |
|
87
|
|
|
* @return void |
|
88
|
|
|
*/ |
|
89
|
|
|
public function publishViews(): void |
|
90
|
|
|
{ |
|
91
|
|
|
if ($this->app->runningInConsole()) { |
|
92
|
|
|
$this->publishes([ |
|
93
|
|
|
__DIR__ . '/resources/views' => resource_path('views'), |
|
94
|
|
|
], 'views'); |
|
95
|
|
|
} |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* Publish Migrations |
|
100
|
|
|
* |
|
101
|
|
|
* @return void |
|
102
|
|
|
*/ |
|
103
|
|
|
public function publishMigrations(): void |
|
104
|
|
|
{ |
|
105
|
|
|
if ($this->app->runningInConsole()) { |
|
106
|
|
|
$this->publishes([ |
|
107
|
|
|
__DIR__ . '/../database/migrations' => database_path('migrations'), |
|
108
|
|
|
], 'migrations'); |
|
109
|
|
|
} |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
/** |
|
113
|
|
|
* Publish Model |
|
114
|
|
|
* |
|
115
|
|
|
* @return void |
|
116
|
|
|
*/ |
|
117
|
|
|
public function publishModel(): void |
|
118
|
|
|
{ |
|
119
|
|
|
if ($this->app->runningInConsole()) { |
|
120
|
|
|
$this->publishes([ |
|
121
|
|
|
__DIR__ . '/Models/Order.php' => app_path('Models/Order.php'), |
|
122
|
|
|
], 'model'); |
|
123
|
|
|
} |
|
124
|
|
|
} |
|
125
|
|
|
|
|
126
|
|
|
/** |
|
127
|
|
|
* Publish Assets |
|
128
|
|
|
* |
|
129
|
|
|
* @return void |
|
130
|
|
|
*/ |
|
131
|
|
|
public function publishAssets(): void |
|
132
|
|
|
{ |
|
133
|
|
|
if ($this->app->runningInConsole()) { |
|
134
|
|
|
$this->publishes([ |
|
135
|
|
|
__DIR__ . '/../public/assets' => public_path('assets'), |
|
136
|
|
|
], 'public-assets'); |
|
137
|
|
|
} |
|
138
|
|
|
} |
|
139
|
|
|
|
|
140
|
|
|
/** |
|
141
|
|
|
* Publish Routes And Controller |
|
142
|
|
|
* |
|
143
|
|
|
* @return void |
|
144
|
|
|
*/ |
|
145
|
|
|
public function publishRoutesAndController(): void |
|
146
|
|
|
{ |
|
147
|
|
|
if ($this->app->runningInConsole()) { |
|
148
|
|
|
$this->publishes([ |
|
149
|
|
|
__DIR__ . '/Http/publish-routes.php' => base_path('routes/sslcommerz.php'), |
|
150
|
|
|
__DIR__ . '/Http/Controllers/PublishSslCommerzPaymentController.php' => app_path('Http/Controllers/SslCommerzPaymentController.php'), |
|
151
|
|
|
], 'routes-controller'); |
|
152
|
|
|
} |
|
153
|
|
|
} |
|
154
|
|
|
} |
|
155
|
|
|
|