1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace WeDevBr\Mati; |
4
|
|
|
|
5
|
|
|
use Illuminate\Support\ServiceProvider; |
6
|
|
|
use WeDevBr\Mati\Support\Contracts\MatiClientInterface; |
7
|
|
|
|
8
|
|
|
class MatiServiceProvider extends ServiceProvider |
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* Bootstrap the application services. |
12
|
|
|
*/ |
13
|
|
|
public function boot() |
14
|
|
|
{ |
15
|
|
|
/* |
16
|
|
|
* Optional methods to load your package assets |
17
|
|
|
*/ |
18
|
|
|
// $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'mati'); |
19
|
|
|
// $this->loadViewsFrom(__DIR__.'/../resources/views', 'mati'); |
20
|
|
|
// $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); |
21
|
|
|
// $this->loadRoutesFrom(__DIR__.'/routes.php'); |
22
|
|
|
|
23
|
|
|
if ($this->app->runningInConsole()) { |
24
|
|
|
$this->publishes([ |
25
|
|
|
__DIR__ . '/../config/config.php' => config_path('mati.php'), |
26
|
|
|
], 'config'); |
27
|
|
|
|
28
|
|
|
// Publishing the views. |
29
|
|
|
/*$this->publishes([ |
30
|
|
|
__DIR__.'/../resources/views' => resource_path('views/vendor/mati'), |
31
|
|
|
], 'views');*/ |
32
|
|
|
|
33
|
|
|
// Publishing assets. |
34
|
|
|
/*$this->publishes([ |
35
|
|
|
__DIR__.'/../resources/assets' => public_path('vendor/mati'), |
36
|
|
|
], 'assets');*/ |
37
|
|
|
|
38
|
|
|
// Publishing the translation files. |
39
|
|
|
/*$this->publishes([ |
40
|
|
|
__DIR__.'/../resources/lang' => resource_path('lang/vendor/mati'), |
41
|
|
|
], 'lang');*/ |
42
|
|
|
|
43
|
|
|
// Registering package commands. |
44
|
|
|
// $this->commands([]); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
$this->app->bind(MatiClientInterface::class, MatiHttpClient::class); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Register the application services. |
52
|
|
|
*/ |
53
|
|
|
public function register() |
54
|
|
|
{ |
55
|
|
|
// Automatically apply the package configuration |
56
|
|
|
$this->mergeConfigFrom(__DIR__ . '/../config/config.php', 'mati'); |
57
|
|
|
|
58
|
|
|
// Register the main class to use with the facade |
59
|
|
|
$this->app->singleton('mati', function () { |
60
|
|
|
return $this->app->make(Mati::class); |
61
|
|
|
}); |
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
|