1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Ladybirdweb\ImportExport; |
4
|
|
|
|
5
|
|
|
use Illuminate\Support\ServiceProvider; |
6
|
|
|
|
7
|
|
|
class ImportExportServiceProvider extends ServiceProvider |
8
|
|
|
{ |
9
|
|
|
/** |
10
|
|
|
* Bootstrap the application services. |
11
|
|
|
* |
12
|
|
|
* @return void |
13
|
|
|
*/ |
14
|
|
|
public function boot() |
15
|
|
|
{ |
16
|
|
|
// Register routes |
17
|
|
|
$this->loadRoutesFrom( __DIR__ . '/routes.php' ); |
18
|
|
|
|
19
|
|
|
// Register database migrations |
20
|
|
|
$this->loadMigrationsFrom( __DIR__ . '/../database/migrations' ); |
21
|
|
|
|
22
|
|
|
// Load views |
23
|
|
|
$this->loadViewsFrom( __DIR__ . '/../resources/views', 'importexport' ); |
24
|
|
|
|
25
|
|
|
|
26
|
|
|
// $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'ladybirdweb'); |
27
|
|
|
|
28
|
|
|
// Publishing is only necessary when using the CLI. |
29
|
|
|
if ( $this->app->runningInConsole() ) { |
30
|
|
|
|
31
|
|
|
// Publishing the configuration file. |
32
|
|
|
$this->publishes([ |
33
|
|
|
__DIR__ . '/../config/import.php' => config_path('ladybirdweb/import-export/import.php'), |
34
|
|
|
], 'import-export.config'); |
35
|
|
|
|
36
|
|
|
$this->publishes([ |
37
|
|
|
__DIR__ . '/../config/export.php' => config_path('ladybirdweb/import-export/export.php'), |
38
|
|
|
], 'import-export.config'); |
39
|
|
|
|
40
|
|
|
// Publishing the views. |
41
|
|
|
$this->publishes([ |
42
|
|
|
__DIR__.'/../resources/views' => base_path('resources/views/vendor/ladybirdweb/import-export'), |
43
|
|
|
], 'import-export.views'); |
44
|
|
|
|
45
|
|
|
// Publishing assets. |
46
|
|
|
$this->publishes([ |
47
|
|
|
__DIR__.'/../public/assets' => public_path('vendor/ladybirdweb/import-export'), |
48
|
|
|
], 'import-export.assets'); |
49
|
|
|
|
50
|
|
|
} |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Register the application services. |
55
|
|
|
* |
56
|
|
|
* @return void |
57
|
|
|
*/ |
58
|
|
|
public function register() |
59
|
|
|
{ |
60
|
|
|
// Merge config |
61
|
|
|
$this->mergeConfigFrom( __DIR__ . '/../config/import.php', 'import' ); |
62
|
|
|
$this->mergeConfigFrom( __DIR__ . '/../config/export.php', 'export' ); |
63
|
|
|
|
64
|
|
|
// Register fecades |
65
|
|
|
$this->app->singleton( 'import', 'Ladybirdweb\ImportExport\Import' ); |
66
|
|
|
$this->app->singleton( 'importhandler', 'Ladybirdweb\ImportExport\ImportHandler' ); |
67
|
|
|
$this->app->singleton( 'importexportlog', 'Ladybirdweb\ImportExport\ImportExportLog' ); |
68
|
|
|
|
69
|
|
|
$this->app->singleton( 'export', 'Ladybirdweb\ImportExport\Export' ); |
70
|
|
|
|
71
|
|
|
// Register import controller |
72
|
|
|
$this->app->singleton( 'Ladybirdweb\ImportExport\Import' ); |
73
|
|
|
|
74
|
|
|
// Register import handler |
75
|
|
|
$this->app->singleton( 'Ladybirdweb\ImportExport\ImportHandler' ); |
76
|
|
|
|
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Get the services provided by the provider. |
81
|
|
|
* |
82
|
|
|
* @return array |
83
|
|
|
*/ |
84
|
|
|
public function provides() |
85
|
|
|
{ |
86
|
|
|
return ['ImportExport']; |
87
|
|
|
} |
88
|
|
|
} |
89
|
|
|
|