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