1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Stl30\LaravelMobilpay; |
4
|
|
|
|
5
|
|
|
use App\Observers\TransactionsObserver; |
6
|
|
|
use Illuminate\Support\Facades\Log; |
7
|
|
|
use Illuminate\Support\ServiceProvider; |
8
|
|
|
|
9
|
|
|
class LaravelMobilpayServiceProvider extends ServiceProvider |
10
|
|
|
{ |
11
|
|
|
/** |
12
|
|
|
* Bootstrap the application services. |
13
|
|
|
*/ |
14
|
|
|
public function boot() |
15
|
|
|
{ |
16
|
|
|
/* |
17
|
|
|
* Optional methods to load your package assets |
18
|
|
|
*/ |
19
|
|
|
$this->loadTranslationsFrom(__DIR__.'/resources/lang', 'laravel-mobilpay'); |
20
|
|
|
$this->loadViewsFrom(__DIR__.'/resources/views', 'laravel-mobilpay'); |
21
|
|
|
$this->loadMigrationsFrom(__DIR__.'/database/migrations'); |
22
|
|
|
$this->loadRoutesFrom(__DIR__.'/routes/web.php'); |
23
|
|
|
|
24
|
|
|
if ($this->app->runningInConsole()) { |
25
|
|
|
$this->publishes([ |
26
|
|
|
__DIR__.'/config/laravel-mobilpay.php' => config_path('laravel-mobilpay.php'), |
27
|
|
|
], 'config'); |
28
|
|
|
|
29
|
|
|
// Publishing the views. |
30
|
|
|
$this->publishes([ |
31
|
|
|
__DIR__.'/resources/views/laravel-mobilpay' => resource_path('views/vendor/laravel-mobilpay'), |
32
|
|
|
], 'views'); |
33
|
|
|
|
34
|
|
|
// Publishing assets. |
35
|
|
|
$this->publishes([ |
36
|
|
|
__DIR__.'/resources/assets' => public_path('vendor/laravel-mobilpay'), |
37
|
|
|
], 'assets'); |
38
|
|
|
|
39
|
|
|
// Publishing the translation files. |
40
|
|
|
$this->publishes([ |
41
|
|
|
__DIR__.'/resources/lang' => resource_path('lang/vendor/laravel-mobilpay'), |
42
|
|
|
], 'lang'); |
43
|
|
|
|
44
|
|
|
|
45
|
|
|
// Publishing custom classes files. |
46
|
|
|
$this->publishes([ |
47
|
|
|
__DIR__.'/LaravelMobilpay' => app_path('LaravelMobilpay'), |
48
|
|
|
__DIR__.'/Http/Controllers/LaravelMobilpay' => app_path('/Http/Controllers/LaravelMobilpay'), |
49
|
|
|
|
50
|
|
|
]); |
51
|
|
|
|
52
|
|
|
// Registering package commands. |
53
|
|
|
// $this->commands([]); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
|
57
|
|
|
if(config('laravel-mobilpay.transaction_observer_active')){ |
58
|
|
|
|
59
|
|
|
// Publishing Observes files. |
60
|
|
|
$this->publishes([ |
61
|
|
|
__DIR__.'/Observers' => app_path('Observers'), |
62
|
|
|
]); |
63
|
|
|
try { |
64
|
|
|
if(class_exists('App\Observers\TransactionsObserver')){ |
65
|
|
|
MobilpayTransaction::observe(TransactionsObserver::class); |
66
|
|
|
} |
67
|
|
|
else{ |
68
|
|
|
Log::debug(__METHOD__.' Transactions observer does not exist'); |
69
|
|
|
} |
70
|
|
|
} catch (Exception $e) { |
|
|
|
|
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
} |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Register the application services. |
78
|
|
|
*/ |
79
|
|
|
public function register() |
80
|
|
|
{ |
81
|
|
|
// Automatically apply the package configuration |
82
|
|
|
$this->mergeConfigFrom(__DIR__ . '/config/laravel-mobilpay.php', 'laravel-mobilpay'); |
83
|
|
|
|
84
|
|
|
// Register the main class to use with the facade |
85
|
|
|
$this->app->singleton('laravel-mobilpay', function () { |
86
|
|
|
return new LaravelMobilpay; |
87
|
|
|
}); |
88
|
|
|
} |
89
|
|
|
} |
90
|
|
|
|
Scrutinizer analyzes your
composer.json
/composer.lock
file if available to determine the classes, and functions that are defined by your dependencies.It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.