|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Rinvex\Subscriptions\Providers; |
|
6
|
|
|
|
|
7
|
|
|
use Rinvex\Subscriptions\Models\Plan; |
|
8
|
|
|
use Illuminate\Support\ServiceProvider; |
|
9
|
|
|
use Rinvex\Support\Traits\ConsoleTools; |
|
10
|
|
|
use Rinvex\Subscriptions\Models\PlanFeature; |
|
11
|
|
|
use Rinvex\Subscriptions\Models\PlanSubscription; |
|
12
|
|
|
use Rinvex\Subscriptions\Models\PlanSubscriptionUsage; |
|
13
|
|
|
use Rinvex\Subscriptions\Console\Commands\MigrateCommand; |
|
14
|
|
|
use Rinvex\Subscriptions\Console\Commands\PublishCommand; |
|
15
|
|
|
use Rinvex\Subscriptions\Console\Commands\RollbackCommand; |
|
16
|
|
|
|
|
17
|
|
|
class SubscriptionsServiceProvider extends ServiceProvider |
|
18
|
|
|
{ |
|
19
|
|
|
use ConsoleTools; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* The commands to be registered. |
|
23
|
|
|
* |
|
24
|
|
|
* @var array |
|
25
|
|
|
*/ |
|
26
|
|
|
protected $commands = [ |
|
27
|
|
|
MigrateCommand::class => 'command.rinvex.subscriptions.migrate', |
|
28
|
|
|
PublishCommand::class => 'command.rinvex.subscriptions.publish', |
|
29
|
|
|
RollbackCommand::class => 'command.rinvex.subscriptions.rollback', |
|
30
|
|
|
]; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Register the application services. |
|
34
|
|
|
* |
|
35
|
|
|
* @return void |
|
36
|
|
|
*/ |
|
37
|
|
|
public function register(): void |
|
38
|
|
|
{ |
|
39
|
|
|
$this->mergeConfigFrom(realpath(__DIR__.'/../../config/config.php'), 'rinvex.subscriptions'); |
|
40
|
|
|
|
|
41
|
|
|
// Bind eloquent models to IoC container |
|
42
|
|
|
$this->registerModels([ |
|
|
|
|
|
|
43
|
|
|
'rinvex.subscriptions.plan' => Plan::class, |
|
44
|
|
|
'rinvex.subscriptions.plan_feature' => PlanFeature::class, |
|
45
|
|
|
'rinvex.subscriptions.plan_subscription' => PlanSubscription::class, |
|
46
|
|
|
'rinvex.subscriptions.plan_subscription_usage' => PlanSubscriptionUsage::class, |
|
47
|
|
|
]); |
|
48
|
|
|
|
|
49
|
|
|
// Register console commands |
|
50
|
|
|
$this->registerCommands($this->commands); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* Bootstrap the application services. |
|
55
|
|
|
* |
|
56
|
|
|
* @return void |
|
57
|
|
|
*/ |
|
58
|
|
|
public function boot(): void |
|
59
|
|
|
{ |
|
60
|
|
|
// Publish Resources |
|
61
|
|
|
$this->publishesConfig('rinvex/laravel-subscriptions'); |
|
62
|
|
|
$this->publishesMigrations('rinvex/laravel-subscriptions'); |
|
63
|
|
|
! $this->autoloadMigrations('rinvex/laravel-subscriptions') || $this->loadMigrationsFrom(__DIR__.'/../../database/migrations'); |
|
64
|
|
|
} |
|
65
|
|
|
} |
|
66
|
|
|
|
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.