1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Mongi\Mongicommerce; |
4
|
|
|
|
5
|
|
|
use Illuminate\Support\Facades\File; |
6
|
|
|
use Illuminate\Support\Facades\Schema; |
7
|
|
|
use Illuminate\Support\Facades\View; |
8
|
|
|
use Illuminate\Support\ServiceProvider; |
9
|
|
|
use Mongi\Mongicommerce\Console\InstallPackage; |
10
|
|
|
use Mongi\Mongicommerce\Libraries\Template; |
11
|
|
|
use Mongi\Mongicommerce\Models\AdminSetting; |
12
|
|
|
use Mongi\Mongicommerce\Models\Category; |
13
|
|
|
|
14
|
|
|
class MongicommerceServiceProvider extends ServiceProvider |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* Bootstrap the application services. |
18
|
|
|
*/ |
19
|
|
|
public function boot() |
20
|
|
|
{ |
21
|
|
|
/* |
22
|
|
|
* Optional methods to load your package assets |
23
|
|
|
*/ |
24
|
|
|
// $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'mongicommerce'); |
25
|
|
|
$this->loadViewsFrom(__DIR__.'/../resources/views', 'mongicommerce'); |
|
|
|
|
26
|
|
|
$this->loadMigrationsFrom(__DIR__.'/../database/migrations'); |
|
|
|
|
27
|
|
|
$this->loadRoutesFrom(__DIR__.'/routes.php'); |
|
|
|
|
28
|
|
|
|
29
|
|
|
if(Schema::hasTable('admin_settings')){ |
30
|
|
|
//inject global information into views |
31
|
|
|
View::share('mongicommerce', AdminSetting::first()); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
if(Schema::hasTable('categories')){ |
35
|
|
|
//inject global information into views |
36
|
|
|
View::share('categories', Template::getStructureCategories()); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
|
40
|
|
|
if ($this->app->runningInConsole()) { |
|
|
|
|
41
|
|
|
|
42
|
|
|
$config_file = config_path('mongicommerce.php'); |
43
|
|
|
if(file_exists($config_file)){ |
44
|
|
|
File::delete($config_file); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
// Publishing the config file. |
48
|
|
|
$this->publishes([ |
|
|
|
|
49
|
|
|
__DIR__.'/../config/config.php' => config_path('mongicommerce.php'), |
50
|
|
|
], 'config'); |
51
|
|
|
|
52
|
|
|
if(file_exists(resource_path('/views/mongicommerce'))){ |
53
|
|
|
File::deleteDirectory(resource_path('/views/mongicommerce')); |
54
|
|
|
} |
55
|
|
|
// Publishing the views. |
56
|
|
|
$this->publishes([ |
57
|
|
|
__DIR__.'/../resources/views/shop' => resource_path('/views/mongicommerce'), |
58
|
|
|
], 'views'); |
59
|
|
|
|
60
|
|
|
if(file_exists(public_path('/mongicommerce/template'))){ |
61
|
|
|
File::deleteDirectory(public_path('/mongicommerce/template')); |
62
|
|
|
} |
63
|
|
|
// Publishing assets. |
64
|
|
|
$this->publishes([ |
65
|
|
|
__DIR__.'/../resources/assets' => public_path('/mongicommerce/template'), |
66
|
|
|
], 'assets'); |
67
|
|
|
|
68
|
|
|
// Registering package commands. |
69
|
|
|
$this->commands([ |
|
|
|
|
70
|
|
|
InstallPackage::class |
71
|
|
|
]); |
72
|
|
|
|
73
|
|
|
// Publishing the translation files. |
74
|
|
|
/*$this->publishes([ |
75
|
|
|
__DIR__.'/../resources/lang' => resource_path('lang/vendor/mongicommerce'), |
76
|
|
|
], 'lang');*/ |
77
|
|
|
|
78
|
|
|
} |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* Register the application services. |
83
|
|
|
*/ |
84
|
|
|
public function register() |
85
|
|
|
{ |
86
|
|
|
// Automatically apply the package configuration |
87
|
|
|
$this->mergeConfigFrom(__DIR__.'/../config/config.php', 'mongicommerce'); |
|
|
|
|
88
|
|
|
|
89
|
|
|
// Register the main class to use with the facade |
90
|
|
|
$this->app->singleton('mongicommerce', function () { |
|
|
|
|
91
|
|
|
return new Mongicommerce; |
92
|
|
|
}); |
93
|
|
|
} |
94
|
|
|
} |
95
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.