forked from larabook/gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGatewayServiceProviderLaravel5.php
70 lines (55 loc) · 1.87 KB
/
GatewayServiceProviderLaravel5.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
namespace Larabookir\Gateway;
use Illuminate\Support\Facades\File;
use Illuminate\Support\ServiceProvider;
class GatewayServiceProviderLaravel5 extends ServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
$config = __DIR__ . '/../config/gateway.php';
$migrations = __DIR__ . '/../migrations/';
$views = __DIR__ . '/../views/';
//php artisan vendor:publish --provider=Larabookir\Gateway\GatewayServiceProvider --tag=config
$this->publishes([
$config => config_path('gateway.php'),
], 'config');
// php artisan vendor:publish --provider=Larabookir\Gateway\GatewayServiceProvider --tag=migrations
$this->publishes([
$migrations => base_path('database/migrations')
], 'migrations');
if (
File::glob(base_path('/database/migrations/*create_gateway_status_log_table\.php'))
&& !File::exists(base_path('/database/migrations/2017_04_05_103357_alter_id_in_transactions_table.php'))
) {
@File::copy($migrations.'/2017_04_05_103357_alter_id_in_transactions_table.php',base_path('database/migrations/2017_04_05_103357_alter_id_in_transactions_table.php'));
}
$this->loadViewsFrom($views, 'gateway');
// php artisan vendor:publish --provider=Larabookir\Gateway\GatewayServiceProvider --tag=views
$this->publishes([
$views => base_path('resources/views/vendor/gateway'),
], 'views');
//$this->mergeConfigFrom( $config,'gateway')
}
/**
* Register the application services.
*
* @return void
*/
public function register()
{
$this->app->singleton('gateway', function () {
return new GatewayResolver();
});
}
}